[lib/workqueue] remove the useless 'delay' factor.
2006-02-02 Paul Jakma <paul.jakma@sun.com>
* workqueue.h: (struct work_queue) Remove the delay field.
It served no purpose and just introduced bad behaviour.
Should be excised before its allowed to escape into 1.0.
This removes need for the 'flood' and runs_since_clear
fields.
* workqueue.c: (general) excise delay factor between queue
runs, hence the 'flood' crap too.. See above.
* bgp_route.c: (bgp_{clear_node,process}_queue_init) delay
field is removed from workqueue spec.
diff --git a/lib/workqueue.c b/lib/workqueue.c
index 0c61f5c..1fa16de 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -82,9 +82,7 @@
new->cycles.granularity = WORK_QUEUE_MIN_GRANULARITY;
/* Default values, can be overriden by caller */
- new->spec.delay = WORK_QUEUE_DEFAULT_DELAY;
new->spec.hold = WORK_QUEUE_DEFAULT_HOLD;
- new->spec.flood = WORK_QUEUE_DEFAULT_FLOOD;
return new;
}
@@ -133,7 +131,7 @@
item->data = data;
listnode_add (wq->items, item);
- work_queue_schedule (wq, wq->spec.delay);
+ work_queue_schedule (wq, wq->spec.hold);
return;
}
@@ -172,14 +170,14 @@
struct work_queue *wq;
vty_out (vty,
- "%c%c %8s %11s %8s %21s%s",
- ' ', ' ', "List","(ms) ","Q. Runs","Cycle Counts ",
+ "%c %8s %5s %8s %21s%s",
+ ' ', "List","(ms) ","Q. Runs","Cycle Counts ",
VTY_NEWLINE);
vty_out (vty,
- "%c%c %8s %5s %5s %8s %7s %6s %6s %s%s",
- 'P', 'F',
+ "%c %8s %5s %8s %7s %6s %6s %s%s",
+ 'P',
"Items",
- "Delay","Hold",
+ "Hold",
"Total",
"Best","Gran.","Avg.",
"Name",
@@ -187,11 +185,10 @@
for (ALL_LIST_ELEMENTS_RO ((&work_queues), node, wq))
{
- vty_out (vty,"%c%c %8d %5d %5d %8ld %7d %6d %6u %s%s",
+ vty_out (vty,"%c %8d %5d %8ld %7d %6d %6u %s%s",
(wq->flags == WQ_PLUGGED ? 'P' : ' '),
- (wq->runs_since_clear >= wq->spec.flood ? 'F' : ' '),
listcount (wq->items),
- wq->spec.delay, wq->spec.hold,
+ wq->spec.hold,
wq->runs,
wq->cycles.best, wq->cycles.granularity,
(wq->runs) ?
@@ -226,7 +223,7 @@
wq->flags = WQ_UNPLUGGED;
/* if thread isnt already waiting, add one */
- work_queue_schedule (wq, wq->spec.delay);
+ work_queue_schedule (wq, wq->spec.hold);
}
/* timer thread to process a work queue
@@ -370,19 +367,9 @@
/* Is the queue done yet? If it is, call the completion callback. */
if (listcount (wq->items) > 0)
- {
- if (++(wq->runs_since_clear) < wq->spec.flood)
- work_queue_schedule (wq, wq->spec.hold);
- else
- work_queue_schedule (wq, 0); /* queue flooded, go into overdrive */
- }
- else
- {
- wq->runs_since_clear = 0;
-
- if (wq->spec.completion_func)
- wq->spec.completion_func (wq);
- }
+ work_queue_schedule (wq, 0);
+ else if (wq->spec.completion_func)
+ wq->spec.completion_func (wq);
return 0;
}