mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-100649: Update native_thread_id after fork (gh-100650)
Update native_thread_id after fork
(cherry picked from commit d52d4942cf)
Co-authored-by: Gabriele N. Tornetta <P403n1x87@users.noreply.github.com>
This commit is contained in:
parent
7ed7127876
commit
d0a9bc5a89
2 changed files with 5 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
||||||
|
Update the native_thread_id field of PyThreadState after fork.
|
||||||
|
|
@ -591,6 +591,10 @@ PyOS_AfterFork_Child(void)
|
||||||
PyThreadState *tstate = _PyThreadState_GET();
|
PyThreadState *tstate = _PyThreadState_GET();
|
||||||
_Py_EnsureTstateNotNULL(tstate);
|
_Py_EnsureTstateNotNULL(tstate);
|
||||||
|
|
||||||
|
#ifdef PY_HAVE_THREAD_NATIVE_ID
|
||||||
|
tstate->native_thread_id = PyThread_get_thread_native_id();
|
||||||
|
#endif
|
||||||
|
|
||||||
status = _PyEval_ReInitThreads(tstate);
|
status = _PyEval_ReInitThreads(tstate);
|
||||||
if (_PyStatus_EXCEPTION(status)) {
|
if (_PyStatus_EXCEPTION(status)) {
|
||||||
goto fatal_error;
|
goto fatal_error;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue