From 3ca7bcc0edd0f26c33264d32e7b6f07276e72e3c Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 7 Dec 2024 19:32:40 -0800 Subject: aio: task_abort was a mistake The use of task_abort to prematurely fail an aio at scheduling time was a mistake, because it could have led to duplicate calls to nng_aio_finish(). We do need to ensure that we leave an indicator so that nni_aio_schedule can return the abort status to caller, in the case that abort is called between the nni_aio_begin and nni_aio_schedule calls. --- include/nng/nng.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/nng/nng.h b/include/nng/nng.h index 3397ca53..0ce5f46c 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -543,6 +543,8 @@ NNG_DECL void nng_aio_reap(nng_aio *); // AIO to be free, including for the callback to have completed // execution. Therefore, the caller must NOT hold any locks that // are acquired in the callback, or deadlock will occur. +// No further operations may be scheduled on the aio, stop is +// a permanent operation. NNG_DECL void nng_aio_stop(nng_aio *); // nng_aio_result returns the status/result of the operation. This @@ -558,6 +560,7 @@ NNG_DECL size_t nng_aio_count(nng_aio *); // nng_aio_cancel attempts to cancel any in-progress I/O operation. // The AIO callback will still be executed, but if the cancellation is // successful then the status will be NNG_ECANCELED. +// An AIO can only be canceled if it was submitted already. NNG_DECL void nng_aio_cancel(nng_aio *); // nng_aio_abort is like nng_aio_cancel, but allows for a different -- cgit v1.2.3-70-g09d2