NNG_AIO(5)

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

πŸ’– NNG_AIO πŸ’–

okay bestie, welcome to the nng_aio page β€” that's the asynchronous I/O handle from the NNG Reference Manual, and yes it's giving main character energy ✨


✨ SYNOPSIS ✨

#include <nng/nng.h>

typedef struct nng_aio nng_aio;

πŸ¦‹ DESCRIPTION πŸ¦‹

so. an nng_aio is an opaque structure β€” meaning you don't get to peek inside, bestie, it's mysterious on purpose πŸ’… β€” and it's used in conjunction with asynchronous I/O operations.

Every single asynchronous operation uses one of these structures. And here's the rule: each one can only be used with a single operation at a time. No sharing, no multitasking that one handle, one op at a time fr fr πŸ™ˆ

Asynchronous operations are performed without blocking the calling application threads. That's the whole point, that's the slay. Instead, your app registers a callback function that gets executed when the operation is complete β€” whether it went great or it went terribly, doesn't matter, it still fires. And this callback will be executed exactly once. Not zero times, not two times. Once. periodt 🌈

The asynchronous I/O framework also supports cancellation of operations that are already in progress (see nng_aio_cancel()), and it lets you set a maximum timeout for them to complete within (see nng_aio_set_timeout()). So you can yeet an op if it's taking too long, iconic behavior honestly πŸ’…

It is also possible to initiate an asynchronous operation, and then wait for it to complete using nng_aio_wait(). Sometimes you just wanna sit there and wait for your lil guy, and that's valid 🫢

These structures are created using nng_aio_alloc(), and destroyed using nng_aio_free(). Make them, use them, free them. The circle of life bestie 🧚


🌸 SEE ALSO 🌸


okay that's the whole page, you ate that πŸ“ this was the NNG Reference Manual version, dated 2026-06-30, and we were literally just reading NNG_AIO(5). go forth and async responsibly, bestie πŸ’–πŸ‘‘

πŸ“¦ where this page comes from