Killing threads

Daniel Franke dfoxfranke at
Tue Sep 27 19:16:55 UTC 2016

On 9/27/16, Gary E. Miller <gem at> wrote:
> There is more than one way to 'kill' a thread.  The nice way is to
> 'kill -HUP', which politely tells the thread to commit seppuku in the
> cleanest way the thread knows how.

Sure, but the default signal handler for that just terminates the
thread immediately and leaves it in a likely-unsafe state. A thread
can install its own signal handler, but the only safe/sane way to
implement one is to have the handler set a condition variable
which the thread then checks for periodically and cleans up if it
finds it set. But in that case, what's the point of using signals?
Just have the parent thread set the condition variable directly,
then join on the child and wait while it cleans up.

More information about the devel mailing list