From 5f69a5ba55058c7f5bfc4d5a250e72c56f31e0eb Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 23 Mar 2018 09:30:13 -0700 Subject: fixes #316 nni_aio_set_synch() usually doesn't do anything --- src/core/aio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/aio.c b/src/core/aio.c index 1aaffe12..f3af80d8 100644 --- a/src/core/aio.c +++ b/src/core/aio.c @@ -392,7 +392,15 @@ nni_aio_finish_impl(nni_aio *aio, int rv, size_t count, nni_msg *msg) aio->a_waiting = 0; nni_cv_wake(&aio->a_cv); } - nni_task_dispatch(&aio->a_task); + + if (!aio->a_synch) { + nni_task_dispatch(&aio->a_task); + } else { + nni_mtx_unlock(&nni_aio_lk); + aio->a_task.task_cb(aio->a_task.task_arg); + nni_mtx_lock(&nni_aio_lk); + aio->a_synch = 0; + } } nni_mtx_unlock(&nni_aio_lk); } -- cgit v1.2.3-70-g09d2