From 98cd3e8c1ef3cb94862c199e87607794bb4b47aa Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Fri, 25 Sep 2020 10:16:14 +0200 Subject: [PATCH] Append notifications to queue --- source/tristanable/manager.d | 12 ++++++++++++ source/tristanable/watcher.d | 7 ++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/source/tristanable/manager.d b/source/tristanable/manager.d index ee4fc42..68f3b21 100644 --- a/source/tristanable/manager.d +++ b/source/tristanable/manager.d @@ -271,6 +271,18 @@ public final class Manager return false; } + + public void addNotification(NotificationReply notificationReply) + { + /* Lock the notification queue */ + lockNotificationQueue(); + + /* Append the notification */ + notificationQueue ~= notificationReply; + + /* Unlock the notification queue */ + unlockNotificationQueue(); + } } diff --git a/source/tristanable/watcher.d b/source/tristanable/watcher.d index 27431fe..bf1d5d2 100644 --- a/source/tristanable/watcher.d +++ b/source/tristanable/watcher.d @@ -92,14 +92,11 @@ public final class Watcher : Thread */ else if(manager.isReservedTag(receivedTag)) { - /* Lock the notification queue */ - manager.lockNotificationQueue(); - /* Create the NotificationReply */ NotificationReply notifyReply = new NotificationReply(receivedTag, receivedMessage); - /* Unlock the notification queue */ - manager.unlockNotificationQueue(); + /* Add the notification */ + manager.addNotification(notifyReply); } else {