[zeromq-dev] zmq_socket and threads

Joshua Foster jhawk28 at gmail.com
Thu Jan 3 01:03:31 CET 2013


The mutex is "required" because it guarantees that it is only used by a 
single thread at a time. ZMQ has assertions that will cause your 
application to crash if you access a socket between two threads 
concurrently.

Joshua

> Nishant Mittal <mailto:nmittal at rblt.com>
> January 2, 2013 6:58 PM
> Charles.. the most relevant (to my use case) piece there is.. "For 
> those situations where a dedicated socket per thread is infeasible, a 
> socket may be shared *if and only if* each thread executes a full 
> memory barrier before accessing the socket. Most languages support a 
> Mutex or Spinlock which will execute the full memory barrier on your 
> behalf."
>
> However, I was wondering that given my app logic below, do I need to 
> use mutex etc?.. each thread is completely independent of the other.. 
> no shared objects.
>
> thanks
> NIshant
>
>
>
>
>
>
> -- 
> *Nishant Mittal*
> Director, Product Development
> *Rosenblatt Securities Inc*.
> 20 Broad Street
> New York, NY 10005
>
> Direct: 212-607-3159
> Mobile: 646-504-2629
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130102/815230ef/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130102/815230ef/attachment.jpg>


More information about the zeromq-dev mailing list