Weird behaviour of sigwait
I am using sigwait to block my thread for some signals. These signals have been added in the sigs set. AS per the doc sigwait is supposed to wait only for the signals passed to it as a set in the argument and is not supposed to change th signal mask of that thread.. But for some reason i dont know, it is changing the signal mask of the thread. It is blocking all signals other than the ones in sigs. I dont wish this to happen. Can someone help me with the same. Thanx in advance
The code snippet:
sigset_t sigs;
int sig_recvd;
sigset_t old_mask;
sigemptyset(&sigs);
sigaddset(&sigs, SIGUSR1);
sigaddset(&sigs, SIGTERM);
sigaddset(&sigs, SIGHUP);
sigaddset(&sigs, SIGINT);
sigaddset(&sigs, SIGPIPE);
sigaddset(&sigs, SIGCHLD);
sigprocmask(SIG_BLOCK, &sigs, &old_mask);
do
{
sigwait(&sigs, &sig_recvd);
//Switch for some signal handling
} while(1);
Sigblk before sigwait: 0000000080014203
Sigblk during sigwait: fffffffefffabcfc
|