From 9cece0bdd4c044f029997b85b73d0b49f80ad1e6 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 26 Dec 2024 11:09:10 -0800 Subject: msg queue: use nni_aio_start --- src/core/msgqueue.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/core/msgqueue.c') diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c index 8118c6c2..f0f2de8b 100644 --- a/src/core/msgqueue.c +++ b/src/core/msgqueue.c @@ -213,14 +213,11 @@ nni_msgq_cancel(nni_aio *aio, void *arg, int rv) void nni_msgq_aio_put(nni_msgq *mq, nni_aio *aio) { - if (nni_aio_begin(aio) != 0) { - return; - } nni_mtx_lock(&mq->mq_lock); // If this is an instantaneous poll operation, and the queue has // no room, nobody is waiting to receive, then report NNG_ETIMEDOUT. - if (!nni_aio_defer(aio, nni_msgq_cancel, mq)) { + if (!nni_aio_start(aio, nni_msgq_cancel, mq)) { nni_mtx_unlock(&mq->mq_lock); return; } @@ -234,11 +231,8 @@ nni_msgq_aio_put(nni_msgq *mq, nni_aio *aio) void nni_msgq_aio_get(nni_msgq *mq, nni_aio *aio) { - if (nni_aio_begin(aio) != 0) { - return; - } nni_mtx_lock(&mq->mq_lock); - if (!nni_aio_defer(aio, nni_msgq_cancel, mq)) { + if (!nni_aio_start(aio, nni_msgq_cancel, mq)) { nni_mtx_unlock(&mq->mq_lock); return; } -- cgit v1.2.3-70-g09d2