Skip to content

Commit d52d494

Browse files
authored
gh-100649: Update native_thread_id after fork (gh-100650)
Update native_thread_id after fork
1 parent e83f88a commit d52d494

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update the native_thread_id field of PyThreadState after fork.

Modules/posixmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,10 @@ PyOS_AfterFork_Child(void)
595595
PyThreadState *tstate = _PyThreadState_GET();
596596
_Py_EnsureTstateNotNULL(tstate);
597597

598+
#ifdef PY_HAVE_THREAD_NATIVE_ID
599+
tstate->native_thread_id = PyThread_get_thread_native_id();
600+
#endif
601+
598602
status = _PyEval_ReInitThreads(tstate);
599603
if (_PyStatus_EXCEPTION(status)) {
600604
goto fatal_error;

0 commit comments

Comments
 (0)