[zeromq-dev] Multiple threads calling zmq_send on a PUSH queue..
Pieter Hintjens
ph at imatix.com
Thu May 12 13:13:51 CEST 2011
On Thu, May 12, 2011 at 1:09 PM, Arvind N <Arvind.N at citrix.com> wrote:
> Will there be any issue if I have say 3 threads pushing data into a
> PUSHQ using the global shared variable zmq_sock being used across threads
> without using any MUTEX in using C ZMQ library….... sample shown below…
>From the http://zguide.zeromq.org/page:all#Multithreading-with-MQ:
"You MUST NOT share ØMQ sockets between threads. ØMQ sockets are not
threadsafe."
This may appear to work in low volume cases, but it will cause
assertion failures in 0MQ due to corrupted socket objects.
Please do NOT use the same socket variable from multiple threads.
Create one socket in each thread.
-Pieter
More information about the zeromq-dev
mailing list