Hacker News new | ask | show | jobs
by cryptonector 2869 days ago
Spawning a new thread to handle a signal is much better than preemption: you then have no concerns about async-signal-safety that aren't plain old thread-safety concerns. I'd much rather have thread-safety constraints than async-signal-safety constraints.
2 comments

Sort of. At least you can mask signals. I agree that threads are probably better overall, but I don't think it's a huge difference.
Linux can do that as well, see SIGEV_THREAD.
Only for AIO, which few use.
You can spawn a thread manually and use the POSIX sigwait() function.
That won't stop the process-wide registered signal handler working and it won't do anything about being able to reliably handle synchronous signals.