summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMark Hammond <mhammond@skippinet.com.au>2004-08-24 22:24:08 (GMT)
committerMark Hammond <mhammond@skippinet.com.au>2004-08-24 22:24:08 (GMT)
commiteb619bb80b651a99abd1fe016d0ac024cbd9677a (patch)
treede42b4d10f9e50b150053df48391d466d0b27b67 /Modules
parent8107ca47ebc79fa9cec8feea69d270f3774da669 (diff)
downloadcpython-eb619bb80b651a99abd1fe016d0ac024cbd9677a.zip
cpython-eb619bb80b651a99abd1fe016d0ac024cbd9677a.tar.gz
cpython-eb619bb80b651a99abd1fe016d0ac024cbd9677a.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/threadmodule.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index b398a25..cba01fa 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -425,11 +425,10 @@ static void
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 @@ t_bootstrap(void *boot_raw)
Py_DECREF(boot->args);
Py_XDECREF(boot->keyw);
PyMem_DEL(boot_raw);
- PyThreadState_Clear(tstate);
- PyThreadState_DeleteCurrent();
+ PyGILState_Release(gstate);
PyThread_exit_thread();
}