Skip to content

Commit

Permalink
reactor: block SIGALRM while we're still not ready to handle it
Browse files Browse the repository at this point in the history
If some code sets up a timer before we've set up the SIGALRM signal handler,
we die.  Block it in the meantime.
  • Loading branch information
avikivity committed Jun 22, 2015
1 parent 6d09819 commit b879fab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/reactor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ reactor::reactor()
sev.sigev_signo = SIGALRM;
r = timer_create(CLOCK_REALTIME, &sev, &_timer);
assert(r >= 0);
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGALRM);
r = ::sigprocmask(SIG_BLOCK, &mask, NULL);
assert(r == 0);
#endif
memory::set_reclaim_hook([this] (std::function<void ()> reclaim_fn) {
// push it in the front of the queue so we reclaim memory quickly
Expand Down

0 comments on commit b879fab

Please sign in to comment.