Skip to content

Commit

Permalink
Manager
Browse files Browse the repository at this point in the history
- Implemented `shutdownAllQueues()`
- Calling `stop()` now shuts down all queues
  • Loading branch information
deavmi committed Nov 26, 2023
1 parent 08757f2 commit 31f7b63
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion source/tristanable/manager/manager.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**
Expand Down

0 comments on commit 31f7b63

Please sign in to comment.