Boost logo

Boost :

Subject: Re: [boost] [thread] thread_specific_ptr performance
From: Peter Dimov (pdimov_at_[hidden])
Date: 2010-01-12 11:19:02


Vicente Botet Escriba wrote:
>>> More, any non-constant time operator* don't satisfy my requirements
>>> for some specific contexts.
>>
>> I don't think that any implementation gives you this constant time
>> guarantee if you continually create thread-specific variables.
>
> When you say "continually create thread-specific variables" do you
> mean without removing them.

Stefan's idea was to reuse slots in the vector. This would avoid
reallocation when keys are created and destroyed at the same rate.
Unfortunately, on second thought, this isn't as straightforward as it
seemed; threads could still hold non-NULL pointers when the key is
destroyed.

pthread_key_delete simply discards these non-NULL pointers without cleaning
them up; the current implementation performs proper cleanup when the threads
end.


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