From 5be691031ae423cf96316f586f69e524846cfd0a Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Tue, 28 Mar 2017 14:36:44 +0200 Subject: Pull request #79 by xwang We can actually call PyThreadState_Delete(), which works without the GIL and seems to pass the same tests. --- c/misc_thread_common.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'c/misc_thread_common.h') 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); } -- cgit v1.2.1