pebbe / zmq4

A Go interface to ZeroMQ version 4
BSD 2-Clause "Simplified" License
1.17k stars 163 forks source link

Is zmq4 go library is thread safe #115

Closed jay11ca39 closed 6 years ago

jay11ca39 commented 6 years ago

Hi @pebbe ,

I want to try the following scenarios:

  1. One thread [go routine] continuously publishing the event.
  2. One thread can terminate the context.

Similar to above, I want to try different scenarios.

omani commented 6 years ago

zmq is not thread safe. I use different contexts when multithreading is needed and mutex them while switching between them.

pebbe commented 6 years ago

zmq4 is as thread safe as ZeroMQ. Context is thread safe. Most sockets are not. There are some newer socket types that are thread safe. Check the documentation for ZeroMQ.