--- embedaddon/quagga/lib/workqueue.c 2012/10/09 09:22:28 1.1.1.2 +++ embedaddon/quagga/lib/workqueue.c 2016/11/02 10:09:11 1.1.1.3 @@ -21,7 +21,7 @@ * 02111-1307, USA. */ -#include +#include #include "thread.h" #include "memory.h" #include "workqueue.h" @@ -30,7 +30,11 @@ #include "log.h" /* master list of work_queues */ -static struct list work_queues; +static struct list _work_queues; +/* pointer primarily to avoid an otherwise harmless warning on + * ALL_LIST_ELEMENTS_RO + */ +static struct list *work_queues = &_work_queues; #define WORK_QUEUE_MIN_GRANULARITY 1 @@ -78,7 +82,7 @@ work_queue_new (struct thread_master *m, const char *q new->items->del = (void (*)(void *)) work_queue_item_free; - listnode_add (&work_queues, new); + listnode_add (work_queues, new); new->cycles.granularity = WORK_QUEUE_MIN_GRANULARITY; @@ -96,13 +100,19 @@ work_queue_free (struct work_queue *wq) /* list_delete frees items via callback */ list_delete (wq->items); - listnode_delete (&work_queues, wq); + listnode_delete (work_queues, wq); XFREE (MTYPE_WORK_QUEUE_NAME, wq->name); XFREE (MTYPE_WORK_QUEUE, wq); return; } +bool +work_queue_is_scheduled (struct work_queue *wq) +{ + return (wq->thread != NULL); +} + static int work_queue_schedule (struct work_queue *wq, unsigned int delay) { @@ -187,7 +197,7 @@ DEFUN(show_work_queues, "Name", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO ((&work_queues), node, wq)) + for (ALL_LIST_ELEMENTS_RO (work_queues, node, wq)) { vty_out (vty,"%c %8d %5d %8ld %7d %6d %6u %s%s", (CHECK_FLAG (wq->flags, WQ_UNPLUGGED) ? ' ' : 'P'),