diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-09 13:33:11 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-22 21:31:28 -0800 |
| commit | c8ce57d668d73d92a071fa86f81e07ca403d8672 (patch) | |
| tree | ad7e602e43fefa64067fdac5fcd23987a50c3a90 /include | |
| parent | 013bb69c6be2f0a4572f4200de05e664692b6704 (diff) | |
| download | nng-c8ce57d668d73d92a071fa86f81e07ca403d8672.tar.gz nng-c8ce57d668d73d92a071fa86f81e07ca403d8672.tar.bz2 nng-c8ce57d668d73d92a071fa86f81e07ca403d8672.zip | |
aio: introduce nni_aio_defer
This will replace nni_aio_schedule, and it includes finishing the
task if needed. It does so without dropping the lock and so is
more efficient and race free.
This includes some conversion of some subsystems to it.
Diffstat (limited to 'include')
| -rw-r--r-- | include/nng/nng.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/nng/nng.h b/include/nng/nng.h index d087805d..4d21287c 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -640,8 +640,11 @@ NNG_DECL void nng_aio_finish(nng_aio *, int); // final argument is passed to the cancelfn. The final argument of the // cancellation function is the error number (will not be zero) corresponding // to the reason for cancellation, e.g. NNG_ETIMEDOUT or NNG_ECANCELED. +// This returns false if the operation cannot be deferred (because the AIO +// has been stopped with nng_aio_stop.) If it does so, then the aio's +// completion callback will fire with a result of NNG_ECLOSED. typedef void (*nng_aio_cancelfn)(nng_aio *, void *, int); -NNG_DECL void nng_aio_defer(nng_aio *, nng_aio_cancelfn, void *); +NNG_DECL bool nng_aio_defer(nng_aio *, nng_aio_cancelfn, void *); // nng_aio_sleep does a "sleeping" operation, basically does nothing // but wait for the specified number of milliseconds to expire, then |
