diff --git a/Include/intrcheck.h b/Include/intrcheck.h index f9658e28b14..85660516900 100644 --- a/Include/intrcheck.h +++ b/Include/intrcheck.h @@ -37,6 +37,7 @@ PERFORMANCE OF THIS SOFTWARE. extern int PyOS_InterruptOccurred Py_PROTO((void)); extern void PyOS_InitInterrupts Py_PROTO((void)); +void PyOS_AfterFork Py_PROTO((void)); #ifdef __cplusplus } diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index e06827aa720..58111efda5e 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1082,6 +1082,7 @@ posix_fork(self, args) pid = fork(); if (pid == -1) return posix_error(); + PyOS_AfterFork(); return PyInt_FromLong((long)pid); } #endif diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index e8154925278..e91c3cb6f60 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -613,3 +613,12 @@ PyOS_InterruptOccurred() } return 0; } + +void +PyOS_AfterFork() +{ +#ifdef WITH_THREAD + main_thread = get_thread_ident(); + main_pid = getpid(); +#endif +} diff --git a/Parser/intrcheck.c b/Parser/intrcheck.c index a2a31452bb4..7fe6205f444 100644 --- a/Parser/intrcheck.c +++ b/Parser/intrcheck.c @@ -219,3 +219,8 @@ PyOS_InterruptOccurred() } #endif /* !OK */ + +void +PyOS_AfterFork() +{ +}