summaryrefslogtreecommitdiff
path: root/src/core/msgqueue.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-02-18 18:38:54 -0800
committerGarrett D'Amore <garrett@damore.org>2017-02-18 18:38:54 -0800
commiteb0d439ac82c49b244615fba4226a0351c4efd64 (patch)
treeacbcfb796088b3b9c572b0b914a35079dc4a5d00 /src/core/msgqueue.c
parent82e058a2abae40760f0f9956cdb9d21f8a512624 (diff)
downloadnng-eb0d439ac82c49b244615fba4226a0351c4efd64.tar.gz
nng-eb0d439ac82c49b244615fba4226a0351c4efd64.tar.bz2
nng-eb0d439ac82c49b244615fba4226a0351c4efd64.zip
We don't need putback on message queues after all.
Diffstat (limited to 'src/core/msgqueue.c')
-rw-r--r--src/core/msgqueue.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c
index 09f58a33..b09bb817 100644
--- a/src/core/msgqueue.c
+++ b/src/core/msgqueue.c
@@ -343,45 +343,6 @@ nni_msgq_put_(nni_msgq *mq, nni_msg *msg, nni_time expire, nni_signal *sig)
}
-// nni_msgq_putback will attempt to put a single message back
-// to the head of the queue. It never blocks. Message queues always
-// have room for at least one putback.
-int
-nni_msgq_putback(nni_msgq *mq, nni_msg *msg)
-{
- nni_mtx_lock(&mq->mq_lock);
-
- // if closed, we don't put more... this check is first!
- if (mq->mq_closed) {
- nni_mtx_unlock(&mq->mq_lock);
- return (NNG_ECLOSED);
- }
-
- // room in the queue?
- if (mq->mq_len >= mq->mq_cap) {
- nni_mtx_unlock(&mq->mq_lock);
- return (NNG_EAGAIN);
- }
-
- // Subtract one from the get index, possibly wrapping.
- mq->mq_get--;
- if (mq->mq_get == 0) {
- mq->mq_get = mq->mq_cap;
- }
- mq->mq_msgs[mq->mq_get] = msg;
- mq->mq_len++;
- if (mq->mq_rwait) {
- mq->mq_rwait = 0;
- nni_cv_wake(&mq->mq_readable);
- }
-
- nni_msgq_kick(mq, NNI_MSGQ_NOTIFY_CANGET);
- nni_mtx_unlock(&mq->mq_lock);
-
- return (0);
-}
-
-
static int
nni_msgq_get_(nni_msgq *mq, nni_msg **msgp, nni_time expire, nni_signal *sig)
{