summaryrefslogtreecommitdiffstats
path: root/Modules/threadmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-07-18 23:57:50 (GMT)
committerGuido van Rossum <guido@python.org>1997-07-18 23:57:50 (GMT)
commit75aa0d6abe706ef4048c1d38c2cde28d8eb924e3 (patch)
treea8096dadf47d2437e750a96e82027f0856178eab /Modules/threadmodule.c
parent2fca21f76280300201acf529527e58e2705ff6aa (diff)
downloadcpython-75aa0d6abe706ef4048c1d38c2cde28d8eb924e3.zip
cpython-75aa0d6abe706ef4048c1d38c2cde28d8eb924e3.tar.gz
cpython-75aa0d6abe706ef4048c1d38c2cde28d8eb924e3.tar.bz2
Use the new functions PyEval_AcquireThread() and
PyEval_ReleaseThread() (in ceval.c) to set/reset the current thread, and at the same time acquire/release the interpreter lock. Much saner.
Diffstat (limited to 'Modules/threadmodule.c')
-rw-r--r--Modules/threadmodule.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index 99ca4af..2201799 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -203,12 +203,11 @@ t_bootstrap(boot_raw)
void *boot_raw;
{
struct bootstate *boot = (struct bootstate *) boot_raw;
- PyThreadState *alttstate, *tstate;
+ PyThreadState *tstate;
PyObject *res;
tstate = PyThreadState_New(boot->interp);
- PyEval_RestoreThread((void *)NULL);
- alttstate = PyThreadState_Swap(tstate);
+ PyEval_AcquireThread(tstate);
res = PyEval_CallObjectWithKeywords(
boot->func, boot->args, boot->keyw);
Py_DECREF(boot->func);
@@ -225,8 +224,7 @@ t_bootstrap(boot_raw)
}
else
Py_DECREF(res);
- (void) PyThreadState_Swap(alttstate);
- (void) PyEval_SaveThread();
+ PyEval_ReleaseThread(tstate);
PyThreadState_Delete(tstate);
exit_thread();
}