mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Merger 65032 to py3k
This commit is contained in:
parent
e921e02a2e
commit
a851397ddc
3 changed files with 130 additions and 1 deletions
|
@ -266,6 +266,9 @@ PyEval_ReleaseThread(PyThreadState *tstate)
|
|||
void
|
||||
PyEval_ReInitThreads(void)
|
||||
{
|
||||
PyObject *threading, *result;
|
||||
PyThreadState *tstate;
|
||||
|
||||
if (!interpreter_lock)
|
||||
return;
|
||||
/*XXX Can't use PyThread_free_lock here because it does too
|
||||
|
@ -275,6 +278,23 @@ PyEval_ReInitThreads(void)
|
|||
interpreter_lock = PyThread_allocate_lock();
|
||||
PyThread_acquire_lock(interpreter_lock, 1);
|
||||
main_thread = PyThread_get_thread_ident();
|
||||
|
||||
/* Update the threading module with the new state.
|
||||
*/
|
||||
tstate = PyThreadState_GET();
|
||||
threading = PyMapping_GetItemString(tstate->interp->modules,
|
||||
"threading");
|
||||
if (threading == NULL) {
|
||||
/* threading not imported */
|
||||
PyErr_Clear();
|
||||
return;
|
||||
}
|
||||
result = PyObject_CallMethod(threading, "_after_fork", NULL);
|
||||
if (result == NULL)
|
||||
PyErr_WriteUnraisable(threading);
|
||||
else
|
||||
Py_DECREF(result);
|
||||
Py_DECREF(threading);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue