From e96f92034dad1a70c92ad4ad863a5259c122cecb Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Mon, 2 Jun 2008 12:03:22 +0000 Subject: + initial edition of meta-queue for RIB updates processing (bug #431) --- lib/ChangeLog | 7 +++++++ lib/workqueue.c | 16 ++-------------- lib/workqueue.h | 3 --- 3 files changed, 9 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/ChangeLog b/lib/ChangeLog index da0fa8ca..d8eb06ec 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,10 @@ +2008-06-02 Denis Ovsienko + + * workqueue.[ch]: completely drop WQ_AIM_HEAD flag and + work_queue_aim_head() function, they aren't needed any more + with the new meta queue structure; (work_queue_run) don't + increment the counter on work item requeueing + 2008-02-28 Paul Jakma * log.c: (mes_lookup) Sowmini Varadhan diagnosed a problem where diff --git a/lib/workqueue.c b/lib/workqueue.c index 8880b9e2..1d32d241 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -67,7 +67,6 @@ work_queue_new (struct thread_master *m, const char *queue_name) new->name = XSTRDUP (MTYPE_WORK_QUEUE_NAME, queue_name); new->master = m; SET_FLAG (new->flags, WQ_UNPLUGGED); - UNSET_FLAG (new->flags, WQ_AIM_HEAD); if ( (new->items = list_new ()) == NULL) { @@ -131,10 +130,7 @@ work_queue_add (struct work_queue *wq, void *data) } item->data = data; - if (CHECK_FLAG (wq->flags, WQ_AIM_HEAD)) - listnode_add_after (wq->items, NULL, item); - else - listnode_add (wq->items, item); + listnode_add (wq->items, item); work_queue_schedule (wq, wq->spec.hold); @@ -231,15 +227,6 @@ work_queue_unplug (struct work_queue *wq) work_queue_schedule (wq, wq->spec.hold); } -void -work_queue_aim_head (struct work_queue *wq, const unsigned aim_head) -{ - if (aim_head) - SET_FLAG (wq->flags, WQ_AIM_HEAD); - else - UNSET_FLAG (wq->flags, WQ_AIM_HEAD); -} - /* timer thread to process a work queue * will reschedule itself if required, * otherwise work_queue_item_add @@ -317,6 +304,7 @@ work_queue_run (struct thread *thread) } case WQ_REQUEUE: { + item->ran--; work_queue_item_requeue (wq, node); break; } diff --git a/lib/workqueue.h b/lib/workqueue.h index 3150c32e..f59499a0 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -48,7 +48,6 @@ struct work_queue_item }; #define WQ_UNPLUGGED (1 << 0) /* available for draining */ -#define WQ_AIM_HEAD (1 << 1) /* add new items before list head, not after tail */ struct work_queue { @@ -119,8 +118,6 @@ extern void work_queue_add (struct work_queue *, void *); extern void work_queue_plug (struct work_queue *wq); /* unplug the queue, allow it to be drained again */ extern void work_queue_unplug (struct work_queue *wq); -/* control the value for WQ_AIM_HEAD flag */ -extern void work_queue_aim_head (struct work_queue *wq, const unsigned); /* Helpers, exported for thread.c and command.c */ extern int work_queue_run (struct thread *); -- cgit v1.2.1