aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-12-04 01:05:41 -0500
committerGarrett D'Amore <garrett@damore.org>2024-12-07 12:17:32 -0800
commit784bfd66e1278890bc2ae3ab3779796c2174eda5 (patch)
tree2b9dbe8be5389a151df46cdeed90871efad9a239 /src/core
parent71e459eea31e9e47c0ce64a78e32b242d357f9a0 (diff)
downloadnng-784bfd66e1278890bc2ae3ab3779796c2174eda5.tar.gz
nng-784bfd66e1278890bc2ae3ab3779796c2174eda5.tar.bz2
nng-784bfd66e1278890bc2ae3ab3779796c2174eda5.zip
aio: stop has to wait for expirations to finish
Diffstat (limited to 'src/core')
-rw-r--r--src/core/aio.c5
1 files changed, 4 insertions, 1 deletions
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) {