[zeromq-dev] HWM behaviour & blocking

Paul Colomiets paul at colomiets.name
Fri Jun 29 15:13:53 CEST 2012

Hi Justin,

On Thu, Jun 28, 2012 at 9:06 PM, Justin Karneges <justin at affinix.com> wrote:
> It's really just for functional completeness of my event-driven wrapper. The
> only time I can see this coming up in practice is an application that pushes a
> message just before exiting.
> For now, I set ZMQ_LINGER to 0 when a socket object is destroyed, making the
> above application impossible to create. What I'm thinking of doing now is
> offering an alternate, blocking-based shutdown method. This would violate the
> spirit of my wrapper, but may work well enough for apps that finish with a
> single socket doing a write-and-exit.

I think you should just set linger and use it. zmq_close() doesn't
block. The zmq_term() blocks. And usually starting an application has
much bigger overhead than sending a message. So in the case of
starting application, doing request(send) and shutting down, this
delay is probably negligible (unless your data is too big and/or
network is overloaded).


More information about the zeromq-dev mailing list