summaryrefslogtreecommitdiffstats
path: root/lib/mqueue.c
diff options
context:
space:
mode:
authorChris Hall <GMCH@hestia.halldom.com>2010-01-17 20:57:21 +0000
committerChris Hall <GMCH@hestia.halldom.com>2010-01-17 20:57:21 +0000
commitb9ec2b0c318e05ad5ea886eaec57fadfe07f6277 (patch)
treed477796ce4fece44ece224e4f97e713152fa73c9 /lib/mqueue.c
parent65229f16936aad129d71875e427e82e4fa6d3f5d (diff)
downloadquagga-b9ec2b0c318e05ad5ea886eaec57fadfe07f6277.tar.bz2
quagga-b9ec2b0c318e05ad5ea886eaec57fadfe07f6277.tar.xz
Further work-in-progress.
modified: bgpd/bgp_connection.c completed pending queue modified: bgpd/bgp_engine.c TODOs for start/stop modified: bgpd/bgp_msg_write.c ) added send_update and send_eor modified: bgpd/bgp_msg_write.h ) modified: bgpd/bgp_open_state.c fixed free modified: bgpd/bgp_packet.c tidied up peer->work usage modified: bgpd/bgp_session.c ) completed various message handlers modified: bgpd/bgp_session.h ) modified: lib/mqueue.c ) added revoke modified: lib/mqueue.h )
Diffstat (limited to 'lib/mqueue.c')
-rw-r--r--lib/mqueue.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/mqueue.c b/lib/mqueue.c
index e1433245..f252586e 100644
--- a/lib/mqueue.c
+++ b/lib/mqueue.c
@@ -603,6 +603,59 @@ done:
} ;
/*------------------------------------------------------------------------------
+ * Revoke message(s)
+ *
+ * Revokes all messages, or only messages whose arg0 matches the given value.
+ * (If the given value is NULL revokes everything.)
+ *
+ * Revokes by calling mqb_dispatch_destroy().
+ *
+ * During a revoke() operation more items may be enqueued, but no other mqueue
+ * operations may be performed. Enqueued items may promptly be revoked, except
+ * for priority items if the revoke operation has already moved past the last
+ * priority item.
+ */
+extern void
+mqueue_revoke(mqueue_queue mq, void* arg0)
+{
+ mqueue_block mqb ;
+ mqueue_block prev ;
+
+ qpt_mutex_lock(&mq->mutex) ;
+
+ prev = NULL ;
+ while (1)
+ {
+ if (prev == NULL)
+ mqb = mq->head ;
+ else
+ mqb = prev->next ;
+
+ if (mqb == NULL)
+ break ;
+
+ if ((arg0 == NULL) || (arg0 == mqb->arg0))
+ {
+ if (prev == NULL)
+ mq->head = mqb->next ;
+ else
+ prev->next = mqb->next ;
+
+ if (mq->tail == mqb)
+ mq->tail = prev ;
+
+ qpt_mutex_unlock(&mq->mutex) ;
+ mqb_dispatch_destroy(mqb) ;
+ qpt_mutex_lock(&mq->mutex) ;
+ }
+ else
+ prev = mqb ;
+ } ;
+
+ qpt_mutex_unlock(&mq->mutex) ;
+} ;
+
+/*------------------------------------------------------------------------------
* No longer waiting for a signal -- does nothing if !qpthreads_enabled.
*
* Returns true <=> signal has been kicked