Subject: Re: [boost] boost::atomic<T> foo;
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-09-21 09:04:44


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;
>>
>
> I am also wondering if there is any ongoing efforts to bring such atomic
> operations library into boost, which is in new C++ draft spec now:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2723.pdf
>
>> Am I left with troublesome usage of boost::mutex to block all that
>> access attempts by myself?
>>
>
> AFAK, it is the only choose, for now.

You can try using Intel TBB library:

http://www.threadingbuildingblocks.org/

I remember there were thoughts of incorporating this library, or its
parts, into Boost, but I'm not aware of what these thoughts led to.