diff options
| author | Mitesh Kanjariya <mitesh@cumulusnetworks.com> | 2018-03-12 14:47:28 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-12 14:47:28 -0700 |
| commit | 9bb3ca515b59b939c5d9941c4fdd4bd2f2dd38d1 (patch) | |
| tree | 5fb91642f1bbc24e10e74a768f46c659b215205b /lib/workqueue.c | |
| parent | 7b1bf203ca189938b41811945fe6a71911574de3 (diff) | |
| parent | 9d16566bb3fbe7a9e15eb8d0cc51bcc3f7997e50 (diff) | |
Merge branch 'master' into type5-default-originate
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); |
