$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] boost::atomic<T> foo;
From: Kris Rousey (krousey_at_[hidden])
Date: 2008-09-21 10:00:11
> cg wrote:
>> Janek Kozicki wrote:
>>> Hi,
>>>
>>> I looked through Boost.Threads and Boost.Interprocess libraries, but
>>> (as far as I can tell) none of them offers me simple:
>>>
>>> class Foo {
>>> boost::atomic<int> bar;
>>> }
>>>
>>> which would mean that *ALL* attempts to access bar would be atomic,
>>> eg. bar=10;
>>>
If all you're wanting is atomic operators, ACE's
(http://www.cs.wustl.edu/~schmidt/ACE.html) ACE_Atomic_Op template
(http://www.dre.vanderbilt.edu/Doxygen/5.6.6/html/ace/a00029.html)
provides that. It synchronizes all arithmetic, assignment, and
comparison operators. I've used it before to do intrusive reference
counting on shared closures. A utility class that just synchronizes
operations shouldn't be too hard to write "boost" way.
--Kris