Signal the parent process when we're ready to serve requests.
This can be used for a hot reload of the process binary. The supervising process can be told when the new process is ready to serve requests.
This commit is contained in:
parent
a9f674497a
commit
b5ffb51e18
@ -306,6 +306,9 @@ int main(int argc, const char *argv[]) try
|
|||||||
sigaddset(&wait_mask, SIGTERM);
|
sigaddset(&wait_mask, SIGTERM);
|
||||||
pthread_sigmask(SIG_BLOCK, &wait_mask, nullptr);
|
pthread_sigmask(SIG_BLOCK, &wait_mask, nullptr);
|
||||||
util::SimpleLogger().Write() << "running and waiting for requests";
|
util::SimpleLogger().Write() << "running and waiting for requests";
|
||||||
|
if(std::getenv("SIGNAL_PARENT_WHEN_READY")) {
|
||||||
|
kill(getppid(), SIGUSR1);
|
||||||
|
}
|
||||||
sigwait(&wait_mask, &sig);
|
sigwait(&wait_mask, &sig);
|
||||||
#else
|
#else
|
||||||
// Set console control handler to allow server to be stopped.
|
// Set console control handler to allow server to be stopped.
|
||||||
|
Loading…
Reference in New Issue
Block a user