Killing threads

Daniel Franke dfoxfranke at
Tue Sep 27 19:03:34 UTC 2016

On Sep 27, 2016 15:00, "Eric S. Raymond" <esr at> wrote:
> Hal Murray <hmurray at>:
> > man 7 signal has a long list of what you can do in a signal handler.
> > other system calls are unsafe)
> >
> > Is there something similar that applies to killing threads?  If so,
where is
> > it documented?
> >
> > For example, if I kill a thread that is in the middle of malloc, are
> > guaranteed to work correctly or can some global state be left in a
> > condition.  (or a lock locked, or ...)
> It varies.  Some library calls are documented to be thread-safe.  The
> version of malloc is; some older versions were not.  In general, if it's
> not documented thread-safe you need to wrap your own mutex around it.

Hal's question was about *killing* threads. Even if a thread only 3
ever makes thread-safe calls, it's still unsafe to kill, because doing so
can leave its mutexes locked and the data they control in an inconsistent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the devel mailing list