mirror of https://github.com/python/cpython
PyOS_AfterFork_Child() pass tstate to _PyEval_ReInitThreads() (GH-20598)
This commit is contained in:
parent
45b34a04a5
commit
317bab0bf6
|
@ -25,7 +25,7 @@ PyAPI_FUNC(int) _PyEval_AddPendingCall(
|
||||||
void *arg);
|
void *arg);
|
||||||
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(PyThreadState *tstate);
|
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(PyThreadState *tstate);
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_FORK
|
||||||
extern PyStatus _PyEval_ReInitThreads(struct pyruntimestate *runtime);
|
extern PyStatus _PyEval_ReInitThreads(PyThreadState *tstate);
|
||||||
#endif
|
#endif
|
||||||
PyAPI_FUNC(void) _PyEval_SetCoroutineOriginTrackingDepth(
|
PyAPI_FUNC(void) _PyEval_SetCoroutineOriginTrackingDepth(
|
||||||
PyThreadState *tstate,
|
PyThreadState *tstate,
|
||||||
|
|
|
@ -470,7 +470,10 @@ PyOS_AfterFork_Child(void)
|
||||||
goto fatal_error;
|
goto fatal_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = _PyEval_ReInitThreads(runtime);
|
PyThreadState *tstate = _PyThreadState_GET();
|
||||||
|
_Py_EnsureTstateNotNULL(tstate);
|
||||||
|
|
||||||
|
status = _PyEval_ReInitThreads(tstate);
|
||||||
if (_PyStatus_EXCEPTION(status)) {
|
if (_PyStatus_EXCEPTION(status)) {
|
||||||
goto fatal_error;
|
goto fatal_error;
|
||||||
}
|
}
|
||||||
|
@ -491,8 +494,9 @@ PyOS_AfterFork_Child(void)
|
||||||
if (_PyStatus_EXCEPTION(status)) {
|
if (_PyStatus_EXCEPTION(status)) {
|
||||||
goto fatal_error;
|
goto fatal_error;
|
||||||
}
|
}
|
||||||
|
assert(_PyThreadState_GET() == tstate);
|
||||||
|
|
||||||
run_at_forkers(_PyInterpreterState_GET()->after_forkers_child, 0);
|
run_at_forkers(tstate->interp->after_forkers_child, 0);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fatal_error:
|
fatal_error:
|
||||||
|
|
|
@ -436,10 +436,9 @@ PyEval_ReleaseThread(PyThreadState *tstate)
|
||||||
which are not running in the child process, and clear internal locks
|
which are not running in the child process, and clear internal locks
|
||||||
which might be held by those threads. */
|
which might be held by those threads. */
|
||||||
PyStatus
|
PyStatus
|
||||||
_PyEval_ReInitThreads(_PyRuntimeState *runtime)
|
_PyEval_ReInitThreads(PyThreadState *tstate)
|
||||||
{
|
{
|
||||||
PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
|
_PyRuntimeState *runtime = tstate->interp->runtime;
|
||||||
_Py_EnsureTstateNotNULL(tstate);
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
|
#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
|
||||||
struct _gil_runtime_state *gil = &tstate->interp->ceval.gil;
|
struct _gil_runtime_state *gil = &tstate->interp->ceval.gil;
|
||||||
|
|
Loading…
Reference in New Issue