diff Modules/threadmodule.c @ 33391:2281140d20c7 2.3

Backport [ 1010677 ] thread Module Breaks PyGILState_Ensure() to the 2.3 maint branch.
author Mark Hammond <mhammond@skippinet.com.au>
date Wed, 01 Sep 2004 22:31:23 +0000
parents 1402f265e48f
children
line wrap: on
line diff
--- a/Modules/threadmodule.c	Tue Aug 31 13:07:54 2004 +0000
+++ b/Modules/threadmodule.c	Wed Sep 01 22:31:23 2004 +0000
@@ -172,11 +172,10 @@
 t_bootstrap(void *boot_raw)
 {
 	struct bootstate *boot = (struct bootstate *) boot_raw;
-	PyThreadState *tstate;
+	PyGILState_STATE gstate;
 	PyObject *res;
 
-	tstate = PyThreadState_New(boot->interp);
-	PyEval_AcquireThread(tstate);
+	gstate = PyGILState_Ensure();
 	res = PyEval_CallObjectWithKeywords(
 		boot->func, boot->args, boot->keyw);
 	if (res == NULL) {
@@ -201,8 +200,7 @@
 	Py_DECREF(boot->args);
 	Py_XDECREF(boot->keyw);
 	PyMem_DEL(boot_raw);
-	PyThreadState_Clear(tstate);
-	PyThreadState_DeleteCurrent();
+	PyGILState_Release(gstate);
 	PyThread_exit_thread();
 }