On Saturday, 2 December 2017 at 04:49:26 UTC, H. S. Teoh wrote:
On Sat, Dec 02, 2017 at 04:38:29AM +0000, Adam D. Ruppe via
Digitalmars-d-learn wrote:
[...]
Signal handlers can potentially be invoked while inside a
non-reentrant libc or OS function, so trying to do anything
that (indirectly or otherwise) calls that function will cause
havoc to your program. Also, while the signal handler is
running, some (all?) further signals may be blocked, meaning
that your program might miss an important signal if your sig
handler takes too long to run. Furthermore, the signal may
have happened in the middle of your own code, so race
conditions may apply (e.g. if you're modifying global data in
both).
[...]
On Linux you can use signalfd() for that, but nice trick if you
want Posix portability.