>
> 3. Another situation is to have a single “main” thread setup all the
> sockets at startup and then hand them off to other threads (and never touch
> them again). Strictly speaking you may only need a memory barrier, but
> using a mutex in this case ensures that you don’t try to use the
Alright, thanks everyone, really useful info. I will rethink my design to
eliminate the need for sharing the sockets between threads :).
On Sun, May 13, 2018 at 1:03 AM Justin Karneges wrote:
> The real issue here is thread affinity. Mere thread-unsafety can always be
>
The real issue here is thread affinity. Mere thread-unsafety can always
be worked-around by the application developer, by ensuring that no two
threads ever access the same resource at the same time. It is my
understanding that libzmq sockets are not thread safe, but they also
don't have thread
1. FWIW, my personal experience has been that it is safe to share a ZMQ_PUB
socket between threads if protected with a mutex. Basically the sequence is
lock/send/unlock.
The alternative is to have an internal zmq_proxy with inproc on one side and
something like TCP on the other side, which is