diff options
author | Armin Rigo <arigo@tunes.org> | 2017-03-28 14:36:44 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2017-03-28 14:36:44 +0200 |
commit | 5be691031ae423cf96316f586f69e524846cfd0a (patch) | |
tree | aa1804d1f78fb17024a28eddf7edb08582e45adb /c/misc_thread_common.h | |
parent | 4d31c6f4ced904f5b63f7a036906aa65bb5f73a6 (diff) | |
download | cffi-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.h | 7 |
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); } |