NNG_AIO_FREE(3)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

πŸ’– 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