Advertisement
wandrake

Untitled

Aug 24th, 2011
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. int signal_view_usr1(void (*handler)(int)) {
  2.     sigset_t set;
  3.     struct sigaction sa;
  4.  
  5.     ec_meno1( sigemptyset(&set) );
  6.     ec_meno1( sigaddset(&set, SIGUSR1) );
  7.     ec_nzero( pthread_sigmask(SIG_UNBLOCK, &set, NULL) );
  8.  
  9.     if (handler != NULL) {
  10.         memset(&sa, 0, sizeof(sa));
  11.         sa.sa_handler = (*handler);
  12.         ec_meno1( sigaction(SIGUSR1, &sa, NULL) );
  13.     }
  14.  
  15.     return 0;
  16.  
  17. EC_CLEANUP_BGN
  18.     return -1;
  19. EC_CLEANUP_END
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement