How this feature will be used in app_python3 - this gives a hook to call PyOS_AfterFork_Parent
:
/**
*
*/
static pid_t main_pid = 0; /* record pid_t of main process */
static int child_init(int rank)
{
if(rank==PROC_INIT) {
/*
* this is called before any process is forked
* so the Python internal state handler
* should be called now.
*/
#if PY_VERSION_HEX >= 0x03070000
PyOS_BeforeFork() ;
#endif
main_pid = getpid();
return 0;
}
if(rank==PROC_POST_FORK) {
/*
* this is called after all processes are forked
* so the Python internal state handler
* should be called.
*/
#if PY_VERSION_HEX >= 0x03070000
PyOS_AfterFork_Parent() ;
#endif
return 0;
}
_apy_process_rank = rank;
/*
* If non-daemonize we are called in the main context
* with rank = PROC_SIPINIT
*/
if (main_pid != getpid()) {
/* we really are a child process */
#if PY_VERSION_HEX >= 0x03070000
PyOS_AfterFork_Child();
#else
PyOS_AfterFork();
#endif
}
if (cfg_child_init()) {
return -1;
}
return apy_init_script(rank);
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.