diff options
author | Chris Hall <GMCH@hestia.halldom.com> | 2010-01-25 17:24:23 +0000 |
---|---|---|
committer | Chris Hall <GMCH@hestia.halldom.com> | 2010-01-25 17:24:23 +0000 |
commit | 8bfae24fc3a8baaca3e419f261f132e454163f57 (patch) | |
tree | fd7cd79932f569213710f78f7213115fb29665e9 /lib/mqueue.c | |
parent | 3aa48517b961f21f9a1721c3a4448a0c45b015c3 (diff) | |
parent | 649f8b0429dc1b25d65c34ee461e448d8f56f410 (diff) | |
download | quagga-8bfae24fc3a8baaca3e419f261f132e454163f57.tar.bz2 quagga-8bfae24fc3a8baaca3e419f261f132e454163f57.tar.xz |
Merge branch 'bgp_engine' of /git/quagga.euro-ix into bgp_engine
Diffstat (limited to 'lib/mqueue.c')
-rw-r--r-- | lib/mqueue.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/mqueue.c b/lib/mqueue.c index f252586e..3031891e 100644 --- a/lib/mqueue.c +++ b/lib/mqueue.c @@ -434,11 +434,15 @@ mqueue_enqueue(mqueue_queue mq, mqueue_block mqb, int priority) { mqb->next = mq->head ; mq->head = mqb ; + /* mq non-empty, enchain at head, therefore tail unaffected */ } else { mqb->next = after->next ; after->next = mqb ; + /* if only have priority messages then fix tail */ + if (mq->tail == after) + mq->tail = mqb; } mq->tail_priority = mqb ; } @@ -593,6 +597,10 @@ mqueue_dequeue(mqueue_queue mq, int wait, void* arg) /* Have something to pull off the queue */ mq->head = mqb->next ; + + /* fix tails if at tail */ + if (mqb == mq->tail) + mq->tail = NULL ; if (mqb == mq->tail_priority) mq->tail_priority = NULL ; @@ -644,6 +652,9 @@ mqueue_revoke(mqueue_queue mq, void* arg0) if (mq->tail == mqb) mq->tail = prev ; + if (mqb == mq->tail_priority) + mq->tail_priority = prev ; + qpt_mutex_unlock(&mq->mutex) ; mqb_dispatch_destroy(mqb) ; qpt_mutex_lock(&mq->mutex) ; |