NNG_AIO_FREE(3)
π NNG_AIO_FREE(3) π
okay bestie, welcome to the NNG Reference Manual β this is the page about nng_aio_free, aka the "girl, you're done here, go rest" function for async I/O handles. sit down, grab a lil matcha, we're gonna talk about cleanup. β¨
πΈ NAME πΈ
nng_aio_free β free an asynchronous I/O handle
π SYNOPSIS π
#include <nng/nng.h>
void nng_aio_free(nng_aio *aio);
void nng_aio_reap(nng_aio *aio);
π¦ DESCRIPTION π¦
So nng_aio_free() does exactly what it says on the tin: it frees an allocated asynchronous I/O handle. bye girl π
But here's the part that actually matters, and it's lowkey the main character of this whole page: if any operation is in progress, that operation gets canceled, and the caller is blocked until the operation is completely canceled. why tho? to make sure it's totally safe to deallocate the handle and any resources attached to it. no dangling vibes, no haunting, none of that. π
And the way it does that is by implicitly calling nng_aio_stop(). cute, right? it's giving "I'll handle it for you." π
Then there's nng_aio_reap(). Same energy as nng_aio_free(), identical behavior, but it does its little work in a background thread. that's the whole difference. This is genuinely useful when you want to discard the aio object from inside the callback for the aio itself β because like, you can't exactly sit there and block waiting for yourself, bestie. π
β οΈ Important β οΈ The second either of these functions is called, the aio object is invalid and it must not be used again. not once. not even a lil peek. it's over, it's finished, periodt. π«
π RETURN VALUES π
None. nothing. nada. it returns void and it means it. π«Ά
π ERRORS π
None. no error codes, no drama, no surprises. iconic honestly. β
π₯ SEE ALSO π₯
and that's the whole page, bestie β go forth and free your handles responsibly π
NNG Reference Manual Β· 2026-06-30 Β· mwah, take care of yourself, drink some water, and don't use freed aios πβ¨
π¦ where this page comes from
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms