From 31f7b6355f97487f499db3e6fb9ec2d71b0b7a6f Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Sun, 26 Nov 2023 19:09:46 +0200 Subject: [PATCH] Manager - Implemented `shutdownAllQueues()` - Calling `stop()` now shuts down all queues --- source/tristanable/manager/manager.d | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/source/tristanable/manager/manager.d b/source/tristanable/manager/manager.d index 4c01341..6ed2bad 100644 --- a/source/tristanable/manager/manager.d +++ b/source/tristanable/manager/manager.d @@ -96,9 +96,33 @@ public class Manager */ public void stop() { + /* Stop the watcher */ watcher.shutdown(); - // TODO: Unblock ALL queues here + /* Unblock all `dequeue()` calls */ + shutdownAllQueues(); + } + + /** + * Shuts down all registered queues + */ + protected void shutdownAllQueues() + { + /* Lock the queue of queues */ + queuesLock.lock(); + + /* On return or error */ + scope(exit) + { + /* Unlock the queue of queues */ + queuesLock.unlock(); + } + + /* Shutdown each queue */ + foreach(Queue queue; this.queues) + { + queue.shutdownQueue(ErrorType.MANAGER_SHUTDOWN); + } } /**