aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-12-26 11:09:10 -0800
committerGarrett D'Amore <garrett@damore.org>2024-12-26 11:09:10 -0800
commit9cece0bdd4c044f029997b85b73d0b49f80ad1e6 (patch)
treeafebde3b63145bb2cc97b38c68e69469b540f01a
parent06ebeefb102b223ff77dd47e16b64bd9575f7c34 (diff)
downloadnng-9cece0bdd4c044f029997b85b73d0b49f80ad1e6.tar.gz
nng-9cece0bdd4c044f029997b85b73d0b49f80ad1e6.tar.bz2
nng-9cece0bdd4c044f029997b85b73d0b49f80ad1e6.zip
msg queue: use nni_aio_start
-rw-r--r--src/core/msgqueue.c10
1 files changed, 2 insertions, 8 deletions
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;
}