summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-01-01 14:50:56 (GMT)
committerGitHub <noreply@github.com>2023-01-01 14:50:56 (GMT)
commitd0a9bc5a89728a66f66835cbeec6a33aa7de26f0 (patch)
tree6d1293076a643dcd50444ef9ac38a66731bfd0cc /Modules/posixmodule.c
parent7ed71278768f2646af0a74caef6648c385d9f334 (diff)
downloadcpython-d0a9bc5a89728a66f66835cbeec6a33aa7de26f0.zip
cpython-d0a9bc5a89728a66f66835cbeec6a33aa7de26f0.tar.gz
cpython-d0a9bc5a89728a66f66835cbeec6a33aa7de26f0.tar.bz2
gh-100649: Update native_thread_id after fork (gh-100650)
Update native_thread_id after fork (cherry picked from commit d52d4942cfdd52a50f88b87b1ff2a67375dbcf47) Co-authored-by: Gabriele N. Tornetta <P403n1x87@users.noreply.github.com>
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 2dfed7c..150bb78 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -591,6 +591,10 @@ PyOS_AfterFork_Child(void)
PyThreadState *tstate = _PyThreadState_GET();
_Py_EnsureTstateNotNULL(tstate);
+#ifdef PY_HAVE_THREAD_NATIVE_ID
+ tstate->native_thread_id = PyThread_get_thread_native_id();
+#endif
+
status = _PyEval_ReInitThreads(tstate);
if (_PyStatus_EXCEPTION(status)) {
goto fatal_error;