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:
Mathias Gug 2016-05-17 16:48:25 -07:00 committed by Patrick Niklaus
parent a9f674497a
commit b5ffb51e18
No known key found for this signature in database
GPG Key ID: E426891B5F978B1B

View File

@ -306,6 +306,9 @@ int main(int argc, const char *argv[]) try
sigaddset(&wait_mask, SIGTERM);
pthread_sigmask(SIG_BLOCK, &wait_mask, nullptr);
util::SimpleLogger().Write() << "running and waiting for requests";
if(std::getenv("SIGNAL_PARENT_WHEN_READY")) {
kill(getppid(), SIGUSR1);
}
sigwait(&wait_mask, &sig);
#else
// Set console control handler to allow server to be stopped.