Boost logo

Boost :

From: William E. Kempf (wekempf_at_[hidden])
Date: 2003-01-23 00:40:18


Philippe A. Bouchard said:
> I have noticed that constant static local variables were preventing
> member functions to be inlined under gcc 2.95. Now fixed.
> http://groups.yahoo.com/group/boost/files/shifted_ptr.zip
>
> Now, it's been a while I did not worked on any locking mechanism but if
> I am accessing one counter and the increment instruction is atomic, why
> would I need to lock anything?

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?

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