[zeromq-dev] thread affinity
justin at affinix.com
Sat Nov 30 21:09:50 CET 2013
On 11/30/2013 10:02 AM, Min RK wrote:
>> On Nov 30, 2013, at 9:30, Justin Karneges <justin at affinix.com> wrote:
>> Great, it sounds like the answer to my question is that it is possible
>> to use the same socket from different threads provided I do my own
>> locking. That's perfectly workable. I mainly wanted to be sure there
>> wasn't something in libzmq explicitly preventing this kind of usage. For
>> example, I believe it is impossible to share a socket across threads
>> with pyzmq, but this must be a limitation imposed in the binding rather
>> than in libzmq.
> Pyzmq imposes no restrictions on how you use sockets, so it is perfectly possible to share them across threads using locks (or not, and just risk segfault).
Good to hear. I could have sworn I hit some "attempt to use socket from
thread it wasn't created in" exception when I tried to do it (even with
locking) but it's been awhile so I could be mistaking things.
More information about the zeromq-dev