Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-09-27 10:26:36


Ben Hutchings wrote:
> John Torjo <john.lists_at_[hidden]> wrote:
>> Alexander Terekhov wrote:
>>
>>> John Torjo wrote:
>>> [...]
>>>
>>>> Whenever a thread (other than main) wants to access this window, it
>>>> will query the weak_pointer. The weak_pointer needs to know the
>>>> LATEST reference count in order to know if the weak pointer is
>>>> still valid. Thus, atomic_read that simply returns the value is not
>>>> enough.
>
> However, the weak_ptr doesn't just use atomic_read. If atomic_read
> returns 0 that means the use count has dropped to 0 [*] and can never
> increase again, so it must be the latest version. Otherwise weak_ptr
> makes a second test that is properly protected. So it can never use
> an old value.
>
> [*] I think this is right but I'm not certain that it can't return a
> 0 that the processor read during creation of an object that
> uses enable_shared_from_this.
>
> Having said all that, I feel the naming of functions may give a false
> sense of generality and encapsulation when they actually only work in
> the way they are being used currently.

I'm not sure which functions do you have in mind here.

> <snip>
>> Here's my scenario:
>> (remember - we're talking about:
>> http://www.pdimov.com/cpp/shared_count_x86_exp2.hpp)
>
> This is still unaccessible. why don't you mail the code to Alexander
> and me (or to the list, in case anyone else is interested)?

http://66.102.9.104/search?q=cache:1ZQ1uXtFUEIJ:www.pdimov.com/cpp/shared_count_x86_exp2.hpp


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