[zeromq-dev] Fwd: ZMQ Closure - Change of Beginners Documentation
sustrik at 250bpm.com
Wed May 25 17:35:58 CEST 2011
> For information, I am not convinced that ETERM will always be the exit
> value returned. In reality It does not matter and I prefer not to test
> for this value. My loop is of the form
> while (!stopped)
> if (rc!=0)
> if (stopped)
> In the main loop -
> reader.stop(); // sets stopped=true
> reader.wait(100) // wait for the reader thread to finish etc.
You need to place "stopped" into critical section to make that work
properly. That in turn will ruin your performance.
> So it is not so important what zmq_recv returns because I know that I am
> When I looked at messageBox.recv for nbytes=0 I found that it is called
> from several call points and not all of them cater for ETERM. I am not
> convinced that ETERM is properly implemented but I did not spend the
> time to analyse each call point to see if it could occur during a
> shutdown scenario.
ETERM is generated by sending "stop" command to individual sockets.
Check zmq::ctx_t::terminate() function. You'll find the following code
for (sockets_t::size_type i = 0; i != sockets.size (); i++)
sockets [i]->stop ();
More information about the zeromq-dev