Hi all,
I have a problem with usage of “sigwaitinfo”.
/* setup waiting for a signal:*/
siginfo_t info;
sigset_t set;
sigfillset(&set);
sigdelset(&set, SIGINT);
sigdelset(&set, SIGHUP);
sigdelset(&set, SIGABRT);
sigdelset(&set, SIGTERM);
sigprocmask(SIG_BLOCK, &set, NULL);
sigemptyset(&set);
sigaddset(&set, SIGINT);
sigaddset(&set, SIGHUP);
sigaddset(&set, SIGABRT);
sigaddset(&set, SIGTERM);
/* should block/wait here */
while(sigwaitinfo(&set, &info) == -1);
printf(“Got signal\n”);
The code above works perfectly,
however, when I start another thread and inside that thread do :
int state;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
pthread_setcancelstate(state, NULL);
then I do not have a printf anymore.
Do you know what the problem can be?
Thanks,
Andrei