nghttpx: Do not compile pthread_sigmask if NOTHREADS is defined

This commit is contained in:
Tatsuhiro Tsujikawa 2014-07-05 19:43:39 +09:00
parent bf4042ce98
commit 9841f778a9
1 changed files with 5 additions and 1 deletions

View File

@ -362,6 +362,7 @@ int event_loop()
// After that, we drop the root privileges if needed. // After that, we drop the root privileges if needed.
drop_privileges(); drop_privileges();
#ifndef NOTHREADS
sigset_t signals; sigset_t signals;
sigemptyset(&signals); sigemptyset(&signals);
sigaddset(&signals, REOPEN_LOG_SIGNAL); sigaddset(&signals, REOPEN_LOG_SIGNAL);
@ -370,6 +371,7 @@ int event_loop()
if(rv != 0) { if(rv != 0) {
LOG(ERROR) << "Blocking REOPEN_LOG_SIGNAL failed: " << strerror(rv); LOG(ERROR) << "Blocking REOPEN_LOG_SIGNAL failed: " << strerror(rv);
} }
#endif // !NOTHREADS
if(get_config()->num_worker > 1) { if(get_config()->num_worker > 1) {
listener_handler->create_worker_thread(get_config()->num_worker); listener_handler->create_worker_thread(get_config()->num_worker);
@ -377,10 +379,12 @@ int event_loop()
listener_handler->create_http2_session(); listener_handler->create_http2_session();
} }
#ifndef NOTHREADS
rv = pthread_sigmask(SIG_UNBLOCK, &signals, nullptr); rv = pthread_sigmask(SIG_UNBLOCK, &signals, nullptr);
if(rv != 0) { if(rv != 0) {
LOG(ERROR) << "Unblocking REOPEN_LOG_SIGNAL failed: " << strerror(rv); LOG(ERROR) << "Unblocking REOPEN_LOG_SIGNAL failed: " << strerror(rv);
} }
#endif // !NOTHREADS
auto reopen_log_signal_event = evsignal_new(evbase, REOPEN_LOG_SIGNAL, auto reopen_log_signal_event = evsignal_new(evbase, REOPEN_LOG_SIGNAL,
reopen_log_signal_cb, reopen_log_signal_cb,