From ef9e9a0740de188a3fe5477e862dd8e3a41bde15 Mon Sep 17 00:00:00 2001 From: John Sully Date: Tue, 26 Mar 2019 20:39:30 -0400 Subject: [PATCH] SIGALRM should happen on a worker thread to make our tests happy Former-commit-id: 10a4b35bc5870aef898d298366f415b163c89efb --- src/server.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/server.cpp b/src/server.cpp index 357c4d3cb..f5a7084ae 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -5089,6 +5089,15 @@ int main(int argc, char **argv) { #endif } } + + /* Block SIGALRM from this thread, it should only be received on a server thread */ + sigset_t sigset; + sigemptyset(&sigset); + sigaddset(&sigset, SIGALRM); + pthread_sigmask(SIG_BLOCK, &sigset, nullptr); + + /* The main thread sleeps until all the workers are done. + this is so that all worker threads are orthogonal in their startup/shutdown */ void *pvRet; pthread_join(rgthread[IDX_EVENT_LOOP_MAIN], &pvRet); return 0;