Add API to clear the signal mask for an active signal handler
Consider code like
int main()
{
// Timeout if it takes too long.
signal(signum("SIGALRM"), timeout);
alarm(20);
// ...
}
void timeout()
{
// Bail out if the timeout code below hangs too.
signal(signum("SIGALRM"), _exit); // PANIC!
alarm(20);
// ...
}
Currently the signal handler installed by timeout()
above will never be called as the SIGALRM
signal is masked during the call of timeout()
.
Add an API to clear the signal mask, so that the second signal handler works as intended.