From a999482fc934eddb6f36770eddcb1b14fa7b19ba Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Wed, 8 Mar 2023 22:06:23 +0200 Subject: [PATCH] Receiver - Added imports - Added a receive queue with a corresponding mutex - Added a field to hold the associated `Client` object Send - Added imports - Added a send queue with a corresponding mutex - Added a field to hold the associated `Client` object --- source/birchwood/client/receiver.d | 16 ++++++++++++++++ source/birchwood/client/sender.d | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/source/birchwood/client/receiver.d b/source/birchwood/client/receiver.d index c4573f4..71cb327 100644 --- a/source/birchwood/client/receiver.d +++ b/source/birchwood/client/receiver.d @@ -2,16 +2,32 @@ module birchwood.client.receiver; import core.thread : Thread; +import std.container.slist : SList; +import core.sync.mutex : Mutex; + // TODO: Examine the below import which seemingly fixes stuff for libsnooze import libsnooze.clib; import libsnooze; +import birchwood.client.core : Client; + public final class ReceiverThread : Thread { + /** + * The receive queue and its lock + */ + private SList!(ubyte[]) recvQueue; + private Mutex recvQueueLock; + /** * The libsnooze event to await on which * when we wake up signals a new message * to be processed and received */ private Event receiveEvent; + + /** + * The associated IRC client + */ + private Client client; } \ No newline at end of file diff --git a/source/birchwood/client/sender.d b/source/birchwood/client/sender.d index 17b4b86..98ada33 100644 --- a/source/birchwood/client/sender.d +++ b/source/birchwood/client/sender.d @@ -2,16 +2,32 @@ module birchwood.client.sender; import core.thread : Thread; +import std.container.slist : SList; +import core.sync.mutex : Mutex; + // TODO: Examine the below import which seemingly fixes stuff for libsnooze import libsnooze.clib; import libsnooze; +import birchwood.client.core : Client; + public final class SenderThread : Thread { + /** + * The send queue and its lock + */ + private SList!(ubyte[]) sendQueue; + private Mutex sendQueueLock; + /** * The libsnooze event to await on which * when we wake up signals a new message * to be processed and sent */ private Event receiveEvent; + + /** + * The associated IRC client + */ + private Client client; } \ No newline at end of file