ZMQ_CTX_DESTROY(3)
π ZMQ_CTX_DESTROY β terminate a 0MQ context π
okay bestie, this is page ZMQ_CTX_DESTROY(3) from the 0MQ Manual, and it's literally the "bye forever" button for a context π«Ά
β¨ SYNOPSIS β¨
int zmq_ctx_destroy (void *context);
π DESCRIPTION π
So zmq_ctx_destroy() shall destroy the 0MQ context context. Like, completely. It's giving end-of-erΠ° energy π
Context termination happens in these steps, in this exact order:
- Any blocking operations currently in progress on sockets open within
contextshall return immediately with an error code ofETERM. And β huge caveat incoming β with the exception ofzmq_close(), any further operations on sockets open withincontextshall fail with an error code ofETERM. So yeah, everything else is locked out fr fr. - After interrupting all blocking calls,
zmq_ctx_destroy()shall block until these conditions are satisfied:- All sockets open within
contexthave been closed withzmq_close(). - For each socket within
context, all messages sent by the application withzmq_send()have either been physically transferred to a network peer, or the socket's linger period set with theZMQ_LINGERsocket option has expired.
- All sockets open within
π¨ bestie listen. Step 2 actually blocks. If your sockets aren't closed and your linger period hasn't expired, you will simply be sitting there. Not a vibe. Plan accordingly π
For further details regarding socket linger behaviour, refer to the ZMQ_LINGER option in zmq_setsockopt(3). It's all in there, iykyk πΈ
This function is deprecated by zmq_ctx_term(3). Yeah. It's the old one. Still works, still documented, but zmq_ctx_term(3) is the main character now π
β RETURN VALUE β
The zmq_ctx_destroy() function shall return zero if successful π Otherwise it shall return -1 and set errno to one of the values defined below. No cap.
π ERRORS π
EFAULTβ the provided context was invalid. Rude, but okay.EINTRβ termination was interrupted by a signal. The good news: it can be restarted if needed π
π¦ SEE ALSO π¦
zmq(7) zmq_init(3) zmq_close(3) zmq_setsockopt(3)
π AUTHORS π
This page was written by the 0MQ community π«Ά To make a change please read the 0MQ Contribution Policy at http://www.zeromq.org/docs:contributing.
and that's the whole page, bestie β¨ this was 0MQ 4.3.5, dated 02/15/2026 β go close your sockets, mwah ππ
π¦ where this page comes from
- arch rolling: zeromq 4.3.5-3 Β· MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms