Hacker News new | ask | show | jobs
by chasil 759 days ago
There were differences between BSD and SYSV signal handling that were problematic in writing portable applications.

https://pubs.opengroup.org/onlinepubs/009604499/functions/bs...

It's important to remember that code in a signal handler must be re-enterant. "Nonreentrant functions are generally unsafe to call from a signal handler."

https://man7.org/linux/man-pages/man7/signal-safety.7.html

1 comments

reentrancy is not sufficient here - at least that provided by mutex style exclusion. the interrupted thread may have actually been the one holding the lock, so if the signal handler enters a queue to wait for it, it may be waiting quite a while
That's why the word reentrant is used, not thread safe.