On Tue, Jan 11, 2011 at 1:23 PM, Zefram <zefram@fysh.org> wrote:
> Paul LeoNerd Evans wrote:
> Restore the whole mask? What if you want to change the blocking status
> of a different signal, in the body of this signal handler?
How about this?
int was_blocked;
sigset_t new, old;
sigemptyset(&new);
sigaddset(&new, sig);
sigprocmask(SIG_BLOCK, &new, &old) = 0;
was_blocked = sigismember(&old, signal);
... { code body here }
if (!was_blocked) {
sigprocmask(SIG_UNBLOCK, new, NULL);
}
Signals can't block themselves that way, but they couldn't do that
before either anyway.
Leon
Thread Previous
|
Thread Next