Commit 75aa0d6a authored by Guido van Rossum's avatar Guido van Rossum

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.
parent 2fca21f7
...@@ -203,12 +203,11 @@ t_bootstrap(boot_raw) ...@@ -203,12 +203,11 @@ t_bootstrap(boot_raw)
void *boot_raw; void *boot_raw;
{ {
struct bootstate *boot = (struct bootstate *) boot_raw; struct bootstate *boot = (struct bootstate *) boot_raw;
PyThreadState *alttstate, *tstate; PyThreadState *tstate;
PyObject *res; PyObject *res;
tstate = PyThreadState_New(boot->interp); tstate = PyThreadState_New(boot->interp);
PyEval_RestoreThread((void *)NULL); PyEval_AcquireThread(tstate);
alttstate = PyThreadState_Swap(tstate);
res = PyEval_CallObjectWithKeywords( res = PyEval_CallObjectWithKeywords(
boot->func, boot->args, boot->keyw); boot->func, boot->args, boot->keyw);
Py_DECREF(boot->func); Py_DECREF(boot->func);
...@@ -225,8 +224,7 @@ t_bootstrap(boot_raw) ...@@ -225,8 +224,7 @@ t_bootstrap(boot_raw)
} }
else else
Py_DECREF(res); Py_DECREF(res);
(void) PyThreadState_Swap(alttstate); PyEval_ReleaseThread(tstate);
(void) PyEval_SaveThread();
PyThreadState_Delete(tstate); PyThreadState_Delete(tstate);
exit_thread(); exit_thread();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment