[zeromq-dev] Exiting blocking calls on shutdown
mkoppanen at php.net
Sun Apr 11 17:17:01 CEST 2010
On Sun, Apr 11, 2010 at 3:42 PM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> The patch currently committed to the trunk solves the problem in the
> following way:
> When context is closed (zmq_term), all threads that are currently
> blocked in blocking calls - such as zmq_recv - will exit immediately
> with ETERM error.
> Any subsequent attempts to use sockets will produce ETERM error.
would it be possible to add something like 'zmq_ping' to check if the
socket is still usable? I would imagine currently seeing whether
socket is still usable is to send/recv.
For example in PHP bindings the context and the socket are persisted
between multiple requests so 'zmq_ping' would allow checking the
liveness of the socket when it's being retrieved. In theory the
context should never be freed before the socket but there should be no
harm in additional checks. I think 'zmq_ping' could also check the
liveness of the actual connections and possibly reconnect if needed.
More information about the zeromq-dev