Boost logo

Boost :

From: William Kempf (williamkempf_at_[hidden])
Date: 2001-08-30 13:47:39


From: "Greg Colvin" <gcolvin_at_[hidden]>
>From: William Kempf <williamkempf_at_[hidden]>
>>From: "Peter Dimov" <pdimov_at_[hidden]>
>> >The reference section doesn't mention that thread_specific_ptr calls
>> >'delete' on the contained pointer on thread exit, though. Only on
>>reset>().
>>
>>Where, within the reference, could I mention this? None of the methods
>>exposed in the interface deal with this event. The fact that reset()
>>requires a pointer to an object created through "new" is a strong
>>indicator,
>>but I understand that this doesn't fully cover things. I can add the text
>>in reset() indicating that the object is deleted on thread termination,
>>but
>>I modeled this off the documentation for std::auto_ptr where they don't
>>make
>>mention of deletion when the object is destroyed.
>
>In 20.4.5.1:
>
> ~auto_ptr() throw();
>
> Requires:
> The expression delete get() is well formed.
> Effects:
> delete get().

Yes, but the problem is that thread_specific_ptr deletes the object when the
thread terminates, not when the thread_specific_ptr is destroyed. With
auto_ptr the "event" that destroyes the contained object is a direct
interface detail and is easily documented. With thread_specific_ptr the
"event" is not an interface detail at all and other than documenting it the
way I have (in the introduction explicitly and implied in the description of
reset()) I don't know how to clarify things better. I agree that it should
be clarified better, I'm just nos sure how :).

Bill Kempf

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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