
15 Feb
2011
15 Feb
'11
2:12 a.m.
Am 15.02.2011 02:44, schrieb Jeremy Maitin-Shepard:
Yes, it would be delivered to an arbitrary thread, but as signal handler settings are shared between threads, it would only be necessary to call signal/sigaction once.
Why do I need multiple threads doing the same? One thread handling signals is sufficient. Delivering the signals ansyc. with sigaction() etc. is dangerous in a multi-threaded app because if the code locks a mutex and then handles a signal delivered asynchronously with let the mutex be locked during the signal handling and may let the mutex be locked forever if the thread exits. This is not what you want at least how long the mutex remains locked should not depend on asnyc. signal handlers.