I&#39;m far from an expert but I always thought that if you were operating on a self-contained 32 or 64 bit quantity (like a number) then memory barriers weren&#39;t necessary.  Only in the general CAS case (for pointers, etc) were barriers required.<div>
<br></div><div>Stephen<br><br><div class="gmail_quote">2011/3/11 Lukáš Lalinský <span dir="ltr">&lt;<a href="mailto:lalinsky@gmail.com">lalinsky@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Sun, Mar 6, 2011 at 12:11 AM, Stephen F. Booth &lt;<a href="mailto:me@sbooth.org">me@sbooth.org</a>&gt; wrote:<br>
&gt; I&#39;m not familiar with atomic operations on Windows or Linux, but I&#39;ve<br>
&gt; attached my first stab at a patch that makes RefCounter use atomic increment<br>
&gt; and decrement operations on OS X.<br>
&gt; I doubt this will take care of everything, but it should be a start.<br>
<br>
</div>I think that we should be using OSAtomicDecrement32Barrier and<br>
OSAtomicIncrement32Barrier, but otherwise it looks fine. Nick already<br>
committed the code to SVN, including a Windows version. I&#39;ll steal<br>
some code from boost to make it work on other platforms too (or<br>
perhaps we could optionally depend on boost?). These changes will not<br>
be released in 1.7, which really should have been released already,<br>
but in the next release.<br>
<br>
Lukas<br>
</blockquote></div><br></div>