Boost logo

Boost Users :

Subject: Re: [Boost-users] at_thread_exit() never getting called
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-11-07 07:18:23


cowwoc wrote:
> Peter Dimov-5 wrote:
>>
>> The at_thread_exit hooks are invoked in the context of the thread.
>> When exit
>> is called, the threads are executing something, and it is not
>> possible to make them stop whatever they are doing in order to
>> execute the at_thread_exit hooks (and it would be a bad idea were it
>> possible, because the thread state could be inconsistent and cause a
>> crash in the hook.)
>>
>
> Peter,
>
> Are you saying that if I register shutdown hooks for threads 1, 2 and
> 3 and invoke exit() from thread 3 the current behavior of
> at_thread_exit() would cause the shutdown hooks to all get invoked by
> thread 3 while thread 1 and 2 are still executing?

I'm not sure what the current behavior is, but in this scenario, no hooks
should be executed. I think that this is consistent with how TSD destructors
work under POSIX, but I can't test this at the moment.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net