When I send a kill -HUP to a multithreaded process, which thread
processes the interrupt? I am concerned because the signal handler
takes out a lock which could be held by the interrupted thread. Do I
have to create a daemon thread and bind the signal handler to that
thread only? If I do this is it safe on a single CPU system?
Another approach is to just set a flag in the signal handler and let
the mainline code handle the event later; but even setting the flag
should be mutex-protected to ensure write coherency on some
architectures, so again I have a potential deadlock. There must be a
simple way to support signal handlers that need locks in a
multi-threaded application!
Thanks!
-K