aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-08-06 23:00:42 +0300
committerGarrett D'Amore <garrett@damore.org>2018-08-06 23:00:42 +0300
commit1c9d966b0ce3574f0baf16201161f3c68d22c556 (patch)
tree59a71a2aadadbc2923dabf0111a76b66f70a8143 /src
parent8bea70c68e3f7ac23d4ff10b758af718ffb94263 (diff)
downloadnng-1c9d966b0ce3574f0baf16201161f3c68d22c556.tar.gz
nng-1c9d966b0ce3574f0baf16201161f3c68d22c556.tar.bz2
nng-1c9d966b0ce3574f0baf16201161f3c68d22c556.zip
fixes #623 nni_aio_stop could be better
Diffstat (limited to 'src')
-rw-r--r--src/core/aio.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/aio.c b/src/core/aio.c
index 40638bce..294a0b92 100644
--- a/src/core/aio.c
+++ b/src/core/aio.c
@@ -217,11 +217,17 @@ void
nni_aio_stop(nni_aio *aio)
{
if (aio != NULL) {
+ nni_aio_cancelfn cancelfn;
+
nni_mtx_lock(&nni_aio_lk);
- aio->a_stop = true;
+ cancelfn = aio->a_prov_cancel;
+ aio->a_prov_cancel = NULL;
+ aio->a_stop = true;
nni_mtx_unlock(&nni_aio_lk);
- nni_aio_abort(aio, NNG_ECANCELED);
+ if (cancelfn != NULL) {
+ cancelfn(aio, NNG_ECANCELED);
+ }
nni_aio_wait(aio);
}