Fix gdb can not work issue
This commit is contained in:
parent
f928956584
commit
5831bff1e9
@ -273,10 +273,12 @@ int main(int argc, const char *argv[]) try
|
|||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
int sig = 0;
|
int sig = 0;
|
||||||
sigset_t new_mask;
|
sigset_t wait_mask;
|
||||||
sigset_t old_mask;
|
sigemptyset(&wait_mask);
|
||||||
sigfillset(&new_mask);
|
sigaddset(&wait_mask, SIGINT);
|
||||||
pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
|
sigaddset(&wait_mask, SIGQUIT);
|
||||||
|
sigaddset(&wait_mask, SIGTERM);
|
||||||
|
pthread_sigmask(SIG_BLOCK, &wait_mask, nullptr); // only block necessary signals
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto service_handler = std::make_unique<server::ServiceHandler>(config);
|
auto service_handler = std::make_unique<server::ServiceHandler>(config);
|
||||||
@ -298,19 +300,13 @@ int main(int argc, const char *argv[]) try
|
|||||||
std::thread server_thread(std::move(server_task));
|
std::thread server_thread(std::move(server_task));
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
sigset_t wait_mask;
|
|
||||||
pthread_sigmask(SIG_SETMASK, &old_mask, nullptr);
|
|
||||||
sigemptyset(&wait_mask);
|
|
||||||
sigaddset(&wait_mask, SIGINT);
|
|
||||||
sigaddset(&wait_mask, SIGQUIT);
|
|
||||||
sigaddset(&wait_mask, SIGTERM);
|
|
||||||
pthread_sigmask(SIG_BLOCK, &wait_mask, nullptr);
|
|
||||||
util::Log() << "running and waiting for requests";
|
util::Log() << "running and waiting for requests";
|
||||||
if (std::getenv("SIGNAL_PARENT_WHEN_READY"))
|
if (std::getenv("SIGNAL_PARENT_WHEN_READY"))
|
||||||
{
|
{
|
||||||
kill(getppid(), SIGUSR1);
|
kill(getppid(), SIGUSR1);
|
||||||
}
|
}
|
||||||
sigwait(&wait_mask, &sig);
|
sigwait(&wait_mask, &sig);
|
||||||
|
util::Log() << "received signal " << sig;
|
||||||
#else
|
#else
|
||||||
// Set console control handler to allow server to be stopped.
|
// Set console control handler to allow server to be stopped.
|
||||||
console_ctrl_function = std::bind(&server::Server::Stop, routing_server);
|
console_ctrl_function = std::bind(&server::Server::Stop, routing_server);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user