Changeset f3b5dc8 for signal.c


Ignore:
Timestamp:
Mar 25, 2011, 3:55:41 AM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Children:
567de81
Parents:
8eb6068
git-author:
David Benjamin <davidben@mit.edu> (02/28/11 10:12:15)
git-committer:
David Benjamin <davidben@mit.edu> (03/25/11 03:55:41)
Message:
Reset signal dispositions and mask, in case our parent was lame

Also check return values more carefully.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • signal.c

    r87833a8 rf3b5dc8  
    11#include <glib.h>
     2#include <errno.h>
    23#include <pthread.h>
    34#include <signal.h>
     
    2122void owl_signal_init(const sigset_t *set, void (*callback)(int, void*), void *data) {
    2223  GError *error = NULL;
     24  int ret;
    2325
    2426  signal_set = *set;
     
    2628  signal_cbdata = data;
    2729  /* Block these signals in all threads, so we can get them. */
    28   pthread_sigmask(SIG_BLOCK, set, NULL);
     30  if ((ret = pthread_sigmask(SIG_BLOCK, set, NULL)) != 0) {
     31    errno = ret;
     32    perror("pthread_sigmask");
     33  }
    2934  /* Spawn a dedicated thread to sigwait. */
    3035  signal_thread = g_thread_create(signal_thread_func, NULL, FALSE, &error);
Note: See TracChangeset for help on using the changeset viewer.