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

This commit is contained in:
Tristan B. Kildaire 2020-09-28 19:17:21 +02:00
parent 7c44f04066
commit b0b7f69778
1 changed files with 4 additions and 4 deletions

View File

@ -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)