Boost logo

Boost :

From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2007-03-05 08:06:19


Peter Dimov wrote:
> Johan Nilsson wrote:
>> Hi,
>>
>> I don't know if this is a known bug or not:
>>
>> When using thread_specific_ptr's, if at any time later in the program
>> the total tss data items drops to zero, it is no longer possible to
>> use tss data.
>
> How can this happen in real code? thread_specific_ptr instances should
> always have static storage duration.

Yes, _should_. Still, the behaviour isn't very intuitive when you look at my
example.

> The only legitimate situation
> appears
> to be to load and then unload a DLL that uses thread_specific_ptr.

Dynamically allocated thread_specific_ptrs (raw pointer to tss ptr). Don't
ask me for the rationale, see below.

I noticed the behaviour when using a third-party library that uses a global
init/deinit function. In the init function, a library internal
thread_specific_ptr is alloc'd and in the deinit it was deleted. One of the
provided functional tests exercised the init/deinit stuff and crashed at the
second, explicit, init call.

/ Johan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk