[zeromq-dev] Breaking blocking in a server app
mato at kotelna.sk
Wed Jun 30 20:28:15 CEST 2010
ellisonbg at gmail.com said:
> > You can destroy the context object from another thread, that will
> > cause all blocking calls to return. You will need to either shutdown
> > then, or create a new context and new sockets.
> Is this part of the official API, or just something that happens to
> work? Because this is a subtle issue, if it is part of the API, we
> may want to mention it in the docs.
It is part of the official API, and it is mentioned in the docs.
In zmq_term(3) / http://api.zeromq.org/zmq_term.html / doc/zmq_term.html :
The _zmq_term()_ function terminates the 0MQ context 'context'.
If there are no longer any sockets open within 'context' at the time
_zmq_term()_ is called then 'context' shall be shut down and all
associated resources shall be released immediately.
Otherwise, the following applies:
* The _zmq_term()_ function shall return immediately.
* Any blocking operations currently in progress on sockets open within
'context' shall return immediately with an error code of ETERM.
* With the exception of _zmq_close()_, any further operations on
sockets open within 'context' shall fail with an error code of ETERM.
* The actual shutdown of 'context', and release of any associated
resources, *shall be delayed* until the last socket within it is
closed with _zmq_close()_.
More information about the zeromq-dev