|
version 1.1.1.2, 2012/10/09 09:22:28
|
version 1.1.1.3, 2016/11/02 10:09:11
|
|
Line 21
|
Line 21
|
| * 02111-1307, USA. |
* 02111-1307, USA. |
| */ |
*/ |
| |
|
| #include <lib/zebra.h> | #include <zebra.h> |
| #include "thread.h" |
#include "thread.h" |
| #include "memory.h" |
#include "memory.h" |
| #include "workqueue.h" |
#include "workqueue.h" |
|
Line 30
|
Line 30
|
| #include "log.h" |
#include "log.h" |
| |
|
| /* master list of work_queues */ |
/* 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 |
#define WORK_QUEUE_MIN_GRANULARITY 1 |
| |
|
|
Line 78 work_queue_new (struct thread_master *m, const char *q
|
Line 82 work_queue_new (struct thread_master *m, const char *q
|
| |
|
| new->items->del = (void (*)(void *)) work_queue_item_free; |
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; |
new->cycles.granularity = WORK_QUEUE_MIN_GRANULARITY; |
| |
|
|
Line 96 work_queue_free (struct work_queue *wq)
|
Line 100 work_queue_free (struct work_queue *wq)
|
| |
|
| /* list_delete frees items via callback */ |
/* list_delete frees items via callback */ |
| list_delete (wq->items); |
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_NAME, wq->name); |
| XFREE (MTYPE_WORK_QUEUE, wq); |
XFREE (MTYPE_WORK_QUEUE, wq); |
| return; |
return; |
| } |
} |
| |
|
| |
bool |
| |
work_queue_is_scheduled (struct work_queue *wq) |
| |
{ |
| |
return (wq->thread != NULL); |
| |
} |
| |
|
| static int |
static int |
| work_queue_schedule (struct work_queue *wq, unsigned int delay) |
work_queue_schedule (struct work_queue *wq, unsigned int delay) |
| { |
{ |
|
Line 187 DEFUN(show_work_queues,
|
Line 197 DEFUN(show_work_queues,
|
| "Name", |
"Name", |
| VTY_NEWLINE); |
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", |
vty_out (vty,"%c %8d %5d %8ld %7d %6d %6u %s%s", |
| (CHECK_FLAG (wq->flags, WQ_UNPLUGGED) ? ' ' : 'P'), |
(CHECK_FLAG (wq->flags, WQ_UNPLUGGED) ? ' ' : 'P'), |