From 1ad7f88e0c58285c9e1cad9448d5a1fcfa7a07f1 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 26 Dec 2024 14:10:09 -0800 Subject: aio: nng_aio_defer replaced by nng_aio_start This represents an API change, and we remove the nng_aio_begin function as well, introducing the lightweight nng_aio_reset instead. --- include/nng/nng.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/nng/nng.h b/include/nng/nng.h index 2563bc1e..b3daedb0 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -618,10 +618,10 @@ NNG_DECL void nng_aio_set_expire(nng_aio *, nng_time); // to succeed if n <= 4, otherwise it may fail due to NNG_ENOMEM. NNG_DECL int nng_aio_set_iov(nng_aio *, unsigned, const nng_iov *); -// nng_aio_begin is called by the provider to mark the operation as -// beginning. If it returns false, then the provider must take no -// further action on the aio. -NNG_DECL bool nng_aio_begin(nng_aio *); +// nng_aio_reset is called by the provider before doing other operations on the +// aio. Its purpose is to clear certain output fields, to avoid accidental +// reuse from prior operations on the aio. +NNG_DECL void nng_aio_reset(nng_aio *); // nng_aio_finish is used to "finish" an asynchronous operation. // It should only be called by "providers" (such as HTTP server API users). @@ -630,7 +630,7 @@ NNG_DECL bool nng_aio_begin(nng_aio *); // given aio. NNG_DECL void nng_aio_finish(nng_aio *, int); -// nng_aio_defer is used to register a cancellation routine, and indicate +// nng_aio_start is used to register a cancellation routine, and indicate // that the operation will be completed asynchronously. It must only be // called once per operation on an aio, and must only be called by providers. // If the operation is canceled by the consumer, the cancellation callback @@ -642,9 +642,9 @@ NNG_DECL void nng_aio_finish(nng_aio *, int); // 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. +// completion callback will fire with a result of NNG_ESTOPPED. typedef void (*nng_aio_cancelfn)(nng_aio *, void *, int); -NNG_DECL bool nng_aio_defer(nng_aio *, nng_aio_cancelfn, void *); +NNG_DECL bool nng_aio_start(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 -- cgit v1.2.3-70-g09d2