From 86582682c97820d8cebfe4a6c4b990d308010eec Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Tue, 15 Sep 2015 16:16:42 +0100 Subject: [PATCH] lib/workqueue: Add trivial work_queue_is_scheduled helper (cherry picked from commit 13c2a3db503fde67f647fa58fd4e1077517ebb5c) --- lib/workqueue.c | 6 ++++++ lib/workqueue.h | 2 ++ 2 files changed, 8 insertions(+) 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; -- 2.39.5