On 02.02.2017 12:49, Stefan Hett wrote:
> On 2/2/2017 12:04 PM, Nick Kew wrote:
>> On Wed, 2017-02-01 at 00:23 +0100, Stefan wrote:
>>> Hi,
>>>
>>> the issue was discovered as part of tracing down a deadlock
>>> condition in
>>> an SVN test [1].
>>>
>>> As far as I understand it, the problem lies in the C-standard not
>>> explicitly defining when a function registered with atexit() is called
>>> in the context of thread termination [2].
>> I had no idea atexit() was called on thread termination.  I guess the
>> manpage must be misleading in telling us it happens at process exit?
> I expressed myself poorly a bit here. I didn't want to suggest
> atexit()-registered functions are called on thread termination but
> rather that threads can be terminated before the atexit-registered
> functions are called.
> So if apr_terminate is registered in a function called from a DLL via
> atexit(), it can happen (and in my scenario does happen) that threads
> got terminated before apr_terminate() is called.

But that should not matter. apr_thread_join() does not terminate a
thread, it waits for the thread to terminate. The thread handle should
remain valid until apr_thread_join() is called, even if the thread
terminated before the join().

-- Brane

Reply via email to