Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: deadlock caused by gettext usage in a signal handler

Le Tue, 04 Dec 2007 18:24:50 +0000,
Peter Stephenson <pws@xxxxxxx> a écrit :

> Guillaume Chazarain wrote:
> > Zsh seems to use dlerror though, hopefully not in a signal handler.
> No, the shell is quite cautious what it executes in signal handlers;
> system errors are pretty much inevitable, but there's no module handling
> there so no call to dlerror.

OK, great.

> > strerror_r also calls into gettext, so I don't see how this solves the
> > problem.
> strerror_r() is the way of ensuring thread safety in printing the
> message by providing a buffer into which data is written.  The GNU
> library manual entry does actually claim it's thread-safe; that
> means that any hidden back-end functions it uses are thread-safe too.

Thread-safety does not imply async-signal-safety. It means locks and
thread local storage, but these do nothing for signals. It would be
great if sticking an _r would make functions callable in signal
handlers ;-)

There are more details in this blog post:



Messages sorted by: Reverse Date, Date, Thread, Author