On Tue, Jan 11, 2011 at 01:55:34PM +0100, Leon Timmermans wrote:
> 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?
Ah, an excellent point.
> 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.
That looks much better yes.
Is there a plan for fixing this? Does anyone want to have a stab at
fixing it (Leon's suggestion there looks good), or should I have a go?
--
Paul "LeoNerd" Evans
leonerd@leonerd.org.uk
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
Thread Previous
|
Thread Next