Tag-based asynchronous messaging framework
Go to file
Tristan B. Kildaire b0b7f69778 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 2020-09-28 19:17:21 +02:00
example Upgraded examples 2020-06-24 11:07:21 +02:00
source/tristanable 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 2020-09-28 19:17:21 +02:00
.gitignore Initial commit 2020-06-19 19:36:57 +02:00
LICENSE Initial commit 2020-06-19 19:36:57 +02:00
README.md Added logo 2020-06-23 11:33:10 +02:00
dub.json Updated source path in dub.json 2020-06-23 11:52:36 +02:00
dub.selections.json Added module structure and stub modules. 2020-06-21 17:27:20 +02:00

README.md

tristanable

Tag-based asynchronous messaging framework

Usage

The entry point is via the Manager type, so first create an instance as follows (passing the endpoint Socket in as socket in this example):

Manager manager = new Manager(socket);

Now the event loop would have started, now we are ready to send out some tagged messages and blocking receive for them!

Let's send out two messages with tags 1 and 2:

manager.sendMessage(1, [1,2,3,4,5]);
manager.sendMessage(2, [6,7,8,9,0]);

Now we can start two seperate threads and wait on them both:

byte[] receivedData = manager.receiveMessage(1);
byte[] receivedData = manager.receiveMessage(2);

TODO

Format

[4 bytes (size-2, little endian)][8 bytes - tag][(2-size) bytes - data]

Acknowledgements

Thansk to Gabby Smuts for the name suggestion 😉