no dead-lock when signal handler calls localtime_r() on FreeBSD, but on Linux

Yuri Pankov yuripv at
Mon Oct 2 06:58:01 UTC 2017

On Mon, 2 Oct 2017 08:34:26 +0200, Matthias Apitz wrote:
> Hello,
> I'm on the way clarifying a deadlock-issue we face on Linux when localtime_r()
> is called in a signal-handler funtion. If you compile the code attached
> below with gcc on Linux, the code gives what one deserves: a dead-lock
> when Ctrl-C is pressed.

Why? I don't see anything explicitly stating that localtime_r() is 

> Interestingly this does not give a dead-lock on my FreeBSD (12-CURRENT)
> system. I checked our man page sigaction(2) but the function is not in
> the list of functions which may be called safe in signal-handlern.
> Any idea, while this does not give a dead-lock on FreeBSD too?

Different implementation? :-)

More information about the freebsd-questions mailing list