diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2020-04-14 16:16:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 16:16:24 (GMT) |
commit | 62f75fe3dd138f72303814d27183aa469eefcca6 (patch) | |
tree | 9d9a3dc0356561974b26f17b65a0a0da18f4ad4d /Python/ceval.c | |
parent | e5014be0497d06d78343623588a80f491a6f7b74 (diff) | |
download | cpython-62f75fe3dd138f72303814d27183aa469eefcca6.zip cpython-62f75fe3dd138f72303814d27183aa469eefcca6.tar.gz cpython-62f75fe3dd138f72303814d27183aa469eefcca6.tar.bz2 |
bpo-40232: Update PyOS_AfterFork_Child() to use _PyThread_at_fork_reinit() (GH-19450)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 16e2d0b..77b7a83 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -397,6 +397,7 @@ PyEval_ReleaseThread(PyThreadState *tstate) drop_gil(&runtime->ceval, tstate); } +#ifdef HAVE_FORK /* This function is called from PyOS_AfterFork_Child to destroy all threads * which are not running in the child process, and clear internal locks * which might be held by those threads. @@ -416,14 +417,14 @@ _PyEval_ReInitThreads(_PyRuntimeState *runtime) take_gil(tstate); struct _pending_calls *pending = &tstate->interp->ceval.pending; - pending->lock = PyThread_allocate_lock(); - if (pending->lock == NULL) { + if (_PyThread_at_fork_reinit(&pending->lock) < 0) { Py_FatalError("Can't initialize threads for pending calls"); } /* Destroy all threads except the current one */ _PyThreadState_DeleteExcept(runtime, tstate); } +#endif /* This function is used to signal that async exceptions are waiting to be raised. */ |