From: Paul Jakma Date: Tue, 15 Sep 2015 15:16:42 +0000 (+0100) Subject: lib/workqueue: Add trivial work_queue_is_scheduled helper X-Git-Tag: frr-2.0-rc1~638 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=86582682c97820d8cebfe4a6c4b990d308010eec;p=matthieu%2Ffrr.git lib/workqueue: Add trivial work_queue_is_scheduled helper (cherry picked from commit 13c2a3db503fde67f647fa58fd4e1077517ebb5c) --- diff --git a/lib/workqueue.c b/lib/workqueue.c index a45a6fc097..3100b99383 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -108,6 +108,12 @@ work_queue_free (struct 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) { diff --git a/lib/workqueue.h b/lib/workqueue.h index 7d9a877d10..19b44041d7 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -122,6 +122,8 @@ extern void work_queue_plug (struct work_queue *wq); /* unplug the queue, allow it to be drained again */ extern void work_queue_unplug (struct work_queue *wq); +bool work_queue_is_scheduled (struct work_queue *); + /* Helpers, exported for thread.c and command.c */ extern int work_queue_run (struct thread *); extern struct cmd_element show_work_queues_cmd;