Having studied the source code of Pyre (Python version of Zyre), I saw the following:
def zcreate_pipe(ctx, hwm=1000):
backend = zsocket.ZSocket(ctx, zmq.PAIR)
frontend = zsocket.ZSocket(ctx, zmq.PAIR)
backend.setsockopt(zmq.LINGER, 0)
frontend.setsockopt(zmq.LINGER, 0)
class ZActor(object):
def __init__(self, ctx, actor, *args, **kwargs):
self.pipe, self.shim_pipe = zhelper.zcreate_pipe(ctx)
def run(self):
self.shim_handler(*self.shim_args, **self.shim_kwargs)
self.shim_pipe.set(zmq.SNDTIMEO, 0)
self.shim_pipe.signal()
self.shim_pipe.close()
def destroy(self):
self.pipe.set(zmq.SNDTIMEO, 0)
self.pipe.send_unicode("$TERM")
self.pipe.wait()
self.pipe.close()
Interesting for me was the use of LINGER=0and SNDTIMEO=0.
Relevant documents here and here :
ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN
[pretty self-evident]
ZMQ_LINGER: set the delay period for disconnecting a socket
[...] The delay period determines how long waiting messages that have not yet been sent to the peer will be delayed in memory after the socket is closed with zmq_close (3) and will additionally affect the completion of the socket context with zmq_term (3 ) [...]
[...]
0 . , zmq_close().
[...]
, . send , SNDTIMEO=0, (, -) LINGER=0 close.
, $TERM , , signal , . , , - (- PAIR over inproc:// transport?), ?
, , / ?