machinarium: block signals from worker threads

This commit is contained in:
Dmitry Simonenko 2017-06-14 15:11:16 +03:00
parent ace516cedd
commit d5ac45b651
2 changed files with 7 additions and 3 deletions

View File

@ -43,9 +43,6 @@ int mm_signalmgr_init(mm_signalmgr_t *mgr, mm_loop_t *loop)
sigset_t mask;
sigemptyset(&mask);
int rc;
rc = sigprocmask(SIG_BLOCK, &mask, NULL);
if (rc == -1)
return -1;
rc = signalfd(-1, &mask, SFD_NONBLOCK);
if (rc == -1)
return -1;
@ -83,6 +80,9 @@ int mm_signalmgr_set(mm_signalmgr_t *mgr, sigset_t *set)
if (rc == -1)
return -1;
assert(rc == mgr->fd.fd);
rc = pthread_sigmask(SIG_BLOCK, set, NULL);
if (rc != 0)
return -1;
return 0;
}

View File

@ -16,6 +16,10 @@ enum {
static void
mm_taskmgr_main(void *arg)
{
sigset_t mask;
sigfillset(&mask);
pthread_sigmask(SIG_BLOCK, &mask, NULL);
(void)arg;
for (;;)
{