[zeromq-dev] Does the zeromq support the spin_lock internally?

Steven McCoy steven.mccoy at miru.hk
Thu Mar 15 00:52:59 CET 2012


On 14 March 2012 17:18, Stephen Hemminger <shemminger at vyatta.com> wrote:

>
> At least on linux there is is pthread_spin_lock()
>

Linux = pthread_spin_lock()
OS X = OSSpinLock()
Win32 = Win32 atomics DIY
GCC = GCC atomics DIY
*BSD, Solaris = BSD atomics DIY

Alternative for systems with unaligned support = ticket based spin locks,
fastest implementation to date.

You can find all these in OpenPGM, I looked around a bit.  Also have RW
spinlocks.  Note some implementations are not hyper-thread safe or SMP
aware.  I went a bit extreme and detect available cores at runtime so that
I also support thread affinity - lock the process to one core and the
spinlocks wont burn time.

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

http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/thread.c
http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/include/impl/ticket.h


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


More information about the zeromq-dev mailing list