NN_TERM(3compat)

πŸ“¦ version 1.11, in alpine 3.24

πŸ’… NN_TERM (3compat) β€” aka the nn_term page, bestie edition

okay so this is the compat-API page for nn_term β€” it lives in section 3compat of the NNG reference manual, and ngl it's a short one but it's important so pay attention πŸŽ€


✨ NAME ✨

nn_term β€” terminate library (compatible API)

like, the whole vibe is "shut it all down." periodt. 🫢


🌸 SYNOPSIS 🌸

#include <nanomsg/nn.h>

void nn_term(void);

no args, no return value, no nothing. it's giving minimal. it's giving clean. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

The nn_term() function closes any open sockets, and frees all resources allocated by the library. Any operations that are currently in progress will be terminated, and will fail with error EBADF or ETERN. iconic cleanup behavior honestly ✨

Note 🧚 This function is provided for API compatibility with legacy libnanomsg. Consider using the relevant modern API instead.
Important πŸ’€ This function is not thread-safe, and is not suitable for use in library calls. The intended purpose of this is to clean up at application termination; for example by registering this function with atexit(). This can help prevent false leak reports caused when memory checkers notice global resources allocated by the library. Libraries should never use this function, but should explicitly close their own sockets directly.

like... fr fr, don't be out here calling nn_term() from inside your library. that's not main character energy, that's just chaos 😭. use atexit() at app teardown and let it slay. and if you're writing a library, close your own sockets directly, bestie β€” that's the move. πŸ‘‘


⭐ RETURN VALUES ⭐

None. literally nothing comes back, it just does the thing. πŸ™ˆ


πŸ’œ ERRORS πŸ’œ

None. no errors reported, she's unbothered. 🌈


πŸ“ SEE ALSO πŸ“

iykyk, go read those next πŸ’–


okay that's the whole page, you ate that 🫢 this was the NNG Reference Manual, dated 2026-01-13, and the page is NN_TERM(3compat) β€” mwah, bye bestie! πŸ’…βœ¨

πŸ“¦ where this page comes from