On Wed, 14 Mar 2012 19:52:59 -0400 Steven McCoy <[email protected]> wrote:
> On 14 March 2012 17:18, Stephen Hemminger <[email protected]> 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 > > Of course the best code uses no locks. Shameless plug for userspace RCU. http://lttng.org/urcu The recent lock-less hash list is really great. _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
