diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-03-13 12:08:38 -0400 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-03-13 12:08:38 -0400 |
| commit | 1f35b46a2f35d59b86ed3ee557aa1c9fcf2fcac9 (patch) | |
| tree | 27de606b3510b126766ac7a0ac9eb8ddf4573ab0 /lib/workqueue.c | |
| parent | d47ae3db4cf14c72d8468d61113ac88e19235791 (diff) | |
| parent | c1a003878246ccc84ab5986558ca959f4545f738 (diff) | |
Merge branch 'master' into docuser
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/workqueue.c')
| -rw-r--r-- | lib/workqueue.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/workqueue.c b/lib/workqueue.c index 952012a006..1af51c06c1 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -101,7 +101,7 @@ struct work_queue *work_queue_new(struct thread_master *m, return new; } -void work_queue_free(struct work_queue *wq) +void work_queue_free_original(struct work_queue *wq) { if (wq->thread != NULL) thread_cancel(wq->thread); @@ -119,6 +119,12 @@ void work_queue_free(struct work_queue *wq) return; } +void work_queue_free_and_null(struct work_queue **wq) +{ + work_queue_free_original(*wq); + *wq = NULL; +} + bool work_queue_is_scheduled(struct work_queue *wq) { return (wq->thread != NULL); @@ -127,8 +133,8 @@ bool work_queue_is_scheduled(struct work_queue *wq) static int work_queue_schedule(struct work_queue *wq, unsigned int delay) { /* if appropriate, schedule work queue thread */ - if (CHECK_FLAG(wq->flags, WQ_UNPLUGGED) && (wq->thread == NULL) && - !work_queue_empty(wq)) { + if (CHECK_FLAG(wq->flags, WQ_UNPLUGGED) && (wq->thread == NULL) + && !work_queue_empty(wq)) { wq->thread = NULL; thread_add_timer_msec(wq->master, work_queue_run, wq, delay, &wq->thread); @@ -159,7 +165,8 @@ void work_queue_add(struct work_queue *wq, void *data) return; } -static void work_queue_item_requeue(struct work_queue *wq, struct work_queue_item *item) +static void work_queue_item_requeue(struct work_queue *wq, + struct work_queue_item *item) { work_queue_item_dequeue(wq, item); |
