aboutsummaryrefslogtreecommitdiff
path: root/src/core/msgqueue.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-28 22:52:53 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-28 22:52:53 -0800
commite8c4e9ebe5d8c2565c79bb906e8298013988ceb0 (patch)
tree392fb1785a1c795cc4313425cc426119c8848a18 /src/core/msgqueue.h
parent3e7507f5908cda4b669bc57293e8395164fcc11a (diff)
downloadnng-e8c4e9ebe5d8c2565c79bb906e8298013988ceb0.tar.gz
nng-e8c4e9ebe5d8c2565c79bb906e8298013988ceb0.tar.bz2
nng-e8c4e9ebe5d8c2565c79bb906e8298013988ceb0.zip
Implement msgqueue_putback.
This function is called when we wish to return a message to the queue after examining it. It can also be used by the resender in the REQ protocol. Critically it does not disrupt the ordering of other messages. This is a non-blocking operation.
Diffstat (limited to 'src/core/msgqueue.h')
-rw-r--r--src/core/msgqueue.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/msgqueue.h b/src/core/msgqueue.h
index 5efbc245..900fed2b 100644
--- a/src/core/msgqueue.h
+++ b/src/core/msgqueue.h
@@ -45,6 +45,12 @@ extern void nni_msgqueue_destroy(nni_msgqueue *);
// the caller is not permitted to access it further.
extern int nni_msgqueue_put(nni_msgqueue *, nni_msg *);
+// nni_msgqueue_putback returns a message to the head of the queue.
+// This is a non-blocking operation, and it returns EAGAIN if there
+// is no room. There is always at least room for one putback after
+// a message is retried with nni_msgqueue_get.
+extern int nni_msgqueue_putback(nni_msgqueue *, nni_msg *);
+
// nni_msgqueue_get gets the message from the queue. It blocks until a
// message is available, or the queue is closed, returning either 0 on
// success or NNG_ECLOSED if the queue was closed. If a message is