summaryrefslogtreecommitdiff
path: root/c/misc_thread_common.h
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2017-03-28 14:36:44 +0200
committerArmin Rigo <arigo@tunes.org>2017-03-28 14:36:44 +0200
commit5be691031ae423cf96316f586f69e524846cfd0a (patch)
treeaa1804d1f78fb17024a28eddf7edb08582e45adb /c/misc_thread_common.h
parent4d31c6f4ced904f5b63f7a036906aa65bb5f73a6 (diff)
downloadcffi-5be691031ae423cf96316f586f69e524846cfd0a.tar.gz
Pull request #79 by xwang
We can actually call PyThreadState_Delete(), which works without the GIL and seems to pass the same tests.
Diffstat (limited to 'c/misc_thread_common.h')
-rw-r--r--c/misc_thread_common.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/c/misc_thread_common.h b/c/misc_thread_common.h
index 1ddf619..d232e7e 100644
--- a/c/misc_thread_common.h
+++ b/c/misc_thread_common.h
@@ -29,12 +29,7 @@ static void cffi_thread_shutdown(void *p)
struct cffi_tls_s *tls = (struct cffi_tls_s *)p;
if (tls->local_thread_state != NULL) {
- /* We need to re-acquire the GIL temporarily to free the
- thread state. I hope it is not a problem to do it in
- a thread-local destructor.
- */
- PyEval_RestoreThread(tls->local_thread_state);
- PyThreadState_DeleteCurrent();
+ PyThreadState_Delete(tls->local_thread_state);
}
free(tls);
}