boost::atomic<T> foo;

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; Am I left with troublesome usage of boost::mutex to block all that access attempts by myself? -- Janek Kozicki |

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.

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.

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

May I volunteer myself for doing that (probably implement the atomic operations draft for boost)? On Sun, Sep 21, 2008 at 11:00 AM, Kris Rousey <krousey@gmail.com> wrote:
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 _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- - Felipe Farinon

Felipe Goron Farinon said: (by the date of Mon, 22 Sep 2008 12:40:16 -0300)
May I volunteer myself for doing that (probably implement the atomic operations draft for boost)?
Would be great, but please make sure to contact Matt Calabrese [1], because he already was working on that some time ago, and had to abandon this due to lack of time. His work should be pretty good, from what Dave has said [2] :) [1] http://lists.boost.org/Archives/boost/2007/07/124651.php [2] http://lists.boost.org/Archives/boost/2007/07/124708.php -- Janek Kozicki |

Ah sure, that would be nice, I tried to contact him with the email that he used in these threads but I got no response, anyone knows how may I reach him? Thank You! On Mon, Sep 22, 2008 at 3:12 PM, Janek Kozicki <janek_listy@wp.pl> wrote:
Felipe Goron Farinon said: (by the date of Mon, 22 Sep 2008 12:40:16 -0300)
May I volunteer myself for doing that (probably implement the atomic operations draft for boost)?
Would be great, but please make sure to contact Matt Calabrese [1], because he already was working on that some time ago, and had to abandon this due to lack of time. His work should be pretty good, from what Dave has said [2] :)
[1] http://lists.boost.org/Archives/boost/2007/07/124651.php [2] http://lists.boost.org/Archives/boost/2007/07/124708.php
-- Janek Kozicki | _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- - Felipe Farinon

Felipe Goron Farinon said: (by the date of Tue, 23 Sep 2008 23:19:32 -0300)
Ah sure, that would be nice, I tried to contact him with the email that he used in these threads but I got no response, anyone knows how may I reach him?
[1] http://lists.boost.org/Archives/boost/2007/07/124651.php
Unfortunately I don't know. But the code which you need is still there: http://svn.boost.org/svn/boost/sandbox/SOC/2006/concurrency you can checkout this and examine. -- Janek Kozicki |

Felipe Goron Farinon wrote:
Ah sure, that would be nice, I tried to contact him with the email that he used in these threads but I got no response, anyone knows how may I reach him?
You might try gamedev.net pm or AIM. http://www.gamedev.net/community/forums/profile.asp?mode=display&id=45319 HTH -- Michael Marcin
participants (6)
-
Andrey Semashev
-
cg
-
Felipe Goron Farinon
-
Janek Kozicki
-
Kris Rousey
-
Michael Marcin