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

Stephen Hemminger shemminger at vyatta.com
Wed Mar 14 22:18:55 CET 2012

On Wed, 14 Mar 2012 11:53:48 -0700
"Richard Zhang" <rzhang at a10networks.com> wrote:

> Hi there,
> When I took a look at the source codes, it shows the ctx_t class
> implementation uses the pthread mutex locking mechanism.  In general, it
> works fine in many applications.   For the SMP architecture, the system runs
> the multicore and each worker thread can acquire the CPU to run for the
> completeness at the same time.  If use the Zeromq for the "inproc"
> communication, the inter-thread transport doesn't need the I/O thread, and
> all messages are in the memory.   It's nice to have the spin_lock
> implemented inside the Zeromq, instead of pthread mutex for this situation.
> It can reduce the context switch to cause the performance penality.  Do you
> have any idea to work around or plan to support it?  Thanks.

At least on linux there is is pthread_spin_lock()

More information about the zeromq-dev mailing list