From 784bfd66e1278890bc2ae3ab3779796c2174eda5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 4 Dec 2024 01:05:41 -0500 Subject: aio: stop has to wait for expirations to finish --- src/core/aio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/aio.c b/src/core/aio.c index bb8347dd..8f405ac7 100644 --- a/src/core/aio.c +++ b/src/core/aio.c @@ -187,12 +187,15 @@ nni_aio_stop(nni_aio *aio) nni_aio_expire_q *eq = aio->a_expire_q; nni_mtx_lock(&eq->eq_mtx); + aio->a_stop = true; + while (aio->a_expiring) { + nni_cv_wait(&eq->eq_cv); + } nni_aio_expire_rm(aio); fn = aio->a_cancel_fn; arg = aio->a_cancel_arg; aio->a_cancel_fn = NULL; aio->a_cancel_arg = NULL; - aio->a_stop = true; nni_mtx_unlock(&eq->eq_mtx); if (fn != NULL) { -- cgit v1.2.3-70-g09d2