[Python-checkins] python/dist/src/Modules threadmodule.c,2.58,2.59

mhammond at users.sourceforge.net mhammond at users.sourceforge.net
Wed Aug 25 00:24:17 CEST 2004


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9226/Modules

Modified Files:
	threadmodule.c 
Log Message:
Fix for [ 1010677 ] thread Module Breaks PyGILState_Ensure(),
and a test case.
When booting a new thread, use the PyGILState API to manage the GIL.


Index: threadmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v
retrieving revision 2.58
retrieving revision 2.59
diff -u -d -r2.58 -r2.59
--- threadmodule.c	14 Jul 2004 19:07:15 -0000	2.58
+++ threadmodule.c	24 Aug 2004 22:24:08 -0000	2.59
@@ -425,11 +425,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) {
@@ -454,8 +453,7 @@
 	Py_DECREF(boot->args);
 	Py_XDECREF(boot->keyw);
 	PyMem_DEL(boot_raw);
-	PyThreadState_Clear(tstate);
-	PyThreadState_DeleteCurrent();
+	PyGILState_Release(gstate);
 	PyThread_exit_thread();
 }
 



More information about the Python-checkins mailing list