[zeromq-dev] thread-safe calls?

Pieter Hintjens ph at imatix.com
Sat Aug 28 20:14:04 CEST 2010


On Sat, Aug 28, 2010 at 7:34 PM, Chuck Remes <cremes.devlist at mac.com> wrote:

> I am wondering if I am misusing the framework. Briefly, the crash occurs when calling zmq_close from another thread on a socket that is blocked on send/recv. It sometimes asserts on object.cpp line 342, sometimes hangs, sometimes segfaults, etc.
>
> I thought it would be safe to call zmq_close on sockets in other threads since calling zmq_term can safely do so. Am I wrong? If so, what is a safe way to signal a blocked socket so it can cleanly shut itself down (without calling zmq_term)?

Calling close on a socket that is not owned by that thread is not safe
afaik.  The correct way to signal any socket is to send it a message.



-
Pieter Hintjens
iMatix - www.imatix.com



More information about the zeromq-dev mailing list