[zeromq-dev] atomic ops

Steven McCoy steven.mccoy at miru.hk
Wed Feb 8 15:19:11 CET 2012


On 7 February 2012 23:34, john skaller <skaller at users.sourceforge.net>wrote:

> I am looking at the atomic ops stuff, and I find this a bit suspicious,
> and also suboptimal:
>
>
It's as optimal as GCC's intrinsics, better than Oracle Studio's intrinsics
and compatible with older GCC compilers.


> Wouldn't it be better to use this function:
>
> type __sync_fetch_and_add (type *ptr, type value, ...)
>
> which is guaranteed to work on all processors?
>
>
There's already a version check in there somewhere, with fallback to a
mutex.  GCC 4.0.1 it made an appearance, so GCC 3 and 2 are not supported,
i.e. older versions of RHEL.

Compare with my atomics:

http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/include/pgm/atomic.h

Of note, Apple added their own intrinsics in addition to GCC, odd.

-- 
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120208/a00f8944/attachment.htm>


More information about the zeromq-dev mailing list