GNU bug report logs -
#14640
SA_RESTART prevents execution of signal handlers
Previous Next
Full log
View this message in rfc822 format
Andy Wingo <wingo <at> pobox.com> skribis:
> On Mon 17 Jun 2013 15:54, ludovic.courtes <at> inria.fr (Ludovic Courtès) writes:
>
>> When using SA_RESTART, signal handlers are never executed, as in this
>> example (checked on 2.0.9+):
>>
>> (sigaction SIGALRM
>> (lambda (signum)
>> (pk 'sig signum))
>> SA_RESTART)
>> (alarm 3)
>> (pk 'char (read-char))
>>
>> Presumably this is because the read(2) syscall is automatically
>> restarted, leaving no chance for the handler async to run.
>
> Thinking about this a bit -- since we always handle signals
> asynchronously and have no intention of handling them synchronously,
> then we just have to document this behavior. Done in e877e1b:
I think it’s problematic though. With the current design, signal
delivery is unreliable (with or without SA_RESTART; what we observe with
SA_RESTART occurs similarly if you make a syscall right after queuing,
but not running, an async.)
The more I think about it, the more I think a different approach is
needed. On GNU/Linux, signalfd(2) may be part of the solution.
Ludo’.
This bug report was last modified 8 years and 333 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.