From b0b7f69778f32cf3a8c8612e0c917aa9f637fa33 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Mon, 28 Sep 2020 19:17:21 +0200 Subject: [PATCH] re-ordered, send after enqueue, a slight conc bug would appear whereby the thread switch to watcher occurs after send (suppose) and then it locks list mjtex, seees no request, says it is an error, this ensures it is a request then sends it so when thread switch to watcher occurs, it MUST be in the list and therefore a valid request --- source/tristanable/manager.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/tristanable/manager.d b/source/tristanable/manager.d index 68f3b21..c0ebb20 100644 --- a/source/tristanable/manager.d +++ b/source/tristanable/manager.d @@ -105,10 +105,7 @@ public final class Manager /* Construct the message array */ byte[] messageData = dataMessage.encode(); - /* Send the message */ - bSendMessage(socket, messageData); - - /* Create a new Request */ + /* Create a new Request */ Request newRequest = new Request(tag); /* Lock the queue for reading */ @@ -119,6 +116,9 @@ public final class Manager /* Unlock the queue */ unlockQueue(); + + /* Send the message */ + bSendMessage(socket, messageData); } public bool isValidTag(ulong tag)