ZMQ_TERM(3)

πŸ“¦
version 4.3.5 Β· 2 versions
, in arch rolling

πŸ’… ZMQ_TERM(3) β€” the 0MQ Manual, but make it make sense

okay so bestie, we're in the 0MQ Manual today and this page is all about zmq_term β€” the terminate the 0MQ context girlie. she's giving "shutting down the whole group chat" energy 🫢


✨ SYNOPSIS ✨

int zmq_term (void *context);

that's it. that's the whole vibe check. one function, one pointer, one big goodbye πŸ‘‹


🌸 DESCRIPTION 🌸

so like β€” the zmq_term() function shall terminate the 0MQ context context. like, fr fr, it ends it. no cap.

context termination is a whole ✨process✨ and it happens in these steps, okay, don't skip ahead:

  1. any blocking operations that are currently in progress on sockets open within context shall return immediately with an error code of ETERM. and with the exception of zmq_close(), any further operations on sockets open within context shall fail with an error code of ETERM. so basically everything gets the ETERM treatment except zmq_close() β€” she's the exception, she's the main character πŸ’…
  2. after interrupting all those blocking calls, zmq_term() shall block until the following conditions are satisfied:
    • all sockets open within context have been closed with zmq_close() πŸ”’
    • for each socket within context, all messages sent by the application with zmq_send() have either been physically transferred to a network peer, or the socket's linger period set with the ZMQ_LINGER socket option has expired ⏳

lowkey important: for further details regarding socket linger behaviour, refer to the ZMQ_LINGER option in zmq_setsockopt(3). she knows things. go read her.

🚨 and bestie, heads up: this function is deprecated by zmq_ctx_term(3). it's giving "old icon, still iconic, but use the new one" β€” so like, keep that in mind. periodt.

πŸ‘‘ RETURN VALUE πŸ‘‘

zmq_term() shall return zero if successful. slay. ✨

otherwise it shall return -1 and set errno to one of the values defined below. not slay. 😭


πŸ’€ ERRORS πŸ’€

  • EFAULT β€” the provided context was invalid. like, it wasn't even a thing. invalid vibes entirely πŸ™ˆ
  • EINTR β€” termination was interrupted by a signal. it can be restarted if needed, so like, no biggie, just try again 🫢

πŸ¦‹ SEE ALSO πŸ¦‹

go read all of them, i'll wait πŸ’–


πŸŽ€ 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 β€” like, they want your edits, it's giving collaborative queen energy 🌈


and that's the page, bestie πŸ’œ this was 0MQ 4.3.5, dated 02/15/2026 β€” mwah, bye, go terminate your contexts responsibly βœ¨πŸ’…

πŸ“¦ where this page comes from