[zeromq-dev] behavior of zmq_term in 2.1.0

Martin Sustrik sustrik at 250bpm.com
Sat Nov 27 23:14:35 CET 2010

On 11/27/2010 10:53 PM, Chuck Remes wrote:
> Let's assume that zmq_term() calls zmq_close() on each known socket.
> Why can't zmq_term() block for a *maximum* of milliseconds as set on each socket by the ZMQ_LINGER option? If the goal is to avoid dropping packets when exiting, then zmq_term() can interrupt those sockets (so that no additional messages can be queued) and then wait ZMQ_LINGER milliseconds before socket termination is complete.
> At that point, the context should be able to exit cleanly.
> Doesn't that solve the original problem of dropping packets on exit? What am I missing?
The fact that there may be other threads still running and using the 
sockets. You cannot deallocate a socket while it is still in use by 
another thread.


More information about the zeromq-dev mailing list