From a19682307f6575017e15aac6f25c089be4389ce6 Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Thu, 6 Nov 2014 10:56:50 +0100 Subject: [PATCH] Problem: zmq_ctx_term has insane behavior by default Solution: document this with a clear warning. It would be nicer perhaps to change the default LINGER to e.g. a few seconds. However this could break existing applications. --- doc/zmq_ctx_term.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/zmq_ctx_term.txt b/doc/zmq_ctx_term.txt index 50951cd1..44c667bc 100644 --- a/doc/zmq_ctx_term.txt +++ b/doc/zmq_ctx_term.txt @@ -23,8 +23,8 @@ Context termination is performed in the following steps: exception of _zmq_close()_, any further operations on sockets open within 'context' shall fail with an error code of ETERM. -2. After interrupting all blocking calls, _zmq_ctx_term()_ shall _block_ until the - following conditions are satisfied: +2. After interrupting all blocking calls, _zmq_ctx_term()_ shall _block_ until + the following conditions are satisfied: * All sockets open within 'context' have been closed with _zmq_close()_. @@ -39,6 +39,15 @@ option in linkzmq:zmq_setsockopt[3]. This function replaces the deprecated function linkzmq:zmq_term[3]. +WARNING +------- + +As _ZMQ_LINGER_ defaults to "infinite", by default this function will block +indefinitely if there are any pending connects or sends. We strongly +recommend to (a) set _ZMQ_LINGER_ to zero on all sockets and (b) close all +sockets, before calling this function. + + RETURN VALUE ------------ The _zmq_ctx_term()_ function shall return zero if successful. Otherwise