csci4061/notes/08-signals-code/sigsets-demo.c
Michael Zhang 041f660ccd
f
2018-01-29 17:28:37 -06:00

28 lines
556 B
C

#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <pwd.h>
#include <string.h>
int main(void) {
sigset_t set;
sigemptyset( &set );
sigaddset( &set, SIGINT);
sigaddset( &set, SIGTERM);
sigaddset( &set, SIGUSR1);
if( sigismember( &set, SIGINT ) ){
printf("This set contains SIGINT\n");
}
sigdelset( &set, SIGUSR1);
if( sigismember( &set, SIGUSR1 ) ){
printf("This set contains SIGUSR1\n");
}
exit(0);
}