[zeromq-dev] atomic ops
Steven McCoy
steven.mccoy at miru.hk
Thu Feb 9 15:43:23 CET 2012
On 9 February 2012 01:14, Ivan Pechorin <ivan.pechorin at gmail.com> wrote:
> 2012/2/8 Steven McCoy <steven.mccoy at miru.hk>:
> >
> > Compare with my atomics:
> >
> >
> http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/include/pgm/atomic.h
>
> Steven, what is the reason to use asm on Solaris/x86 instead of
> Solaris intrinsics from <atomic.h> ?
>
Solaris intrinsics are actually poorer implementations using CAS-only.
>
> #elif (defined( __SUNPRO_C ) || defined( __SUNPRO_CC )) && (defined(
> __i386 ) || defined( __amd64 ))
> uint32_t result = val;
> __asm__ volatile ("lock; xaddl %0, %1"
> :: "r" (result), "m" (*atomic) );
> return result;
>
> And (sorry for stupid question), why the asm for x86/x86_64 is
> different for SunCC and for GCC/ICC ?
>
SunCC doesn't support the same level of clobber clauses.
>
> By the way, HP-UX also has the same intrinsics in <atomic.h>.
> So, I believe, it's worth changing
>
> #if defined( __sun )
> # include <atomic.h>
>
> to something like this:
>
> #if (defined(sun) || defined(__sun) || defined(hpux) || defined(__hpux))
>
>
I don't support IA64 in quite a few places in the code which is why there
is no HP-UX support.
--
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120209/0f4dc9dc/attachment.htm>
More information about the zeromq-dev
mailing list