I'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'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"><<a href="mailto:lalinsky@gmail.com">lalinsky@gmail.com</a>></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 <<a href="mailto:me@sbooth.org">me@sbooth.org</a>> wrote:<br>
> I'm not familiar with atomic operations on Windows or Linux, but I've<br>
> attached my first stab at a patch that makes RefCounter use atomic increment<br>
> and decrement operations on OS X.<br>
> 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'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>