|
Boost : |
From: William E. Kempf (wekempf_at_[hidden])
Date: 2003-01-23 01:51:15
Philippe A. Bouchard said:
>
> "William E. Kempf" <wekempf_at_[hidden]> wrote in message
> news:4258.167.16.75.51.1043300418.squirrel_at_frodo.kempf-ville.com...
>
> [...]
>
>> You may not need to. It wholly depends on context. The key is that
>> atomic increments need not (portability issue) insure memory
>> visibility. If what you do next doesn't rely on the visibility of any
>> memory, you won't need a full lock.
>>
>> The other issue is how you know the increment is atomic?
>
> You mean that there is no way to increment the counter and copy its
> value atomically...?
Not portably, no. Something that Boost.Threads may help with in the
future (something along the lines of Alexander's pthread_refcount_t).
William E. Kempf
wekempf_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk