Message-Passing

Mariusz Gliwiński alienballance at gmail.com
Sun Jan 22 14:16:58 PST 2012


On Thursday, 19 January 2012 at 22:36:17 UTC, Sean Kelly wrote:
> Thanks :-)  If you have ideas on how it could be improved, 
> please let me know.

I don't know whether it's good or not, but in my system based on 
std.concurrency:
* i had to add in-thread messaging in case when there will be 
more actors than threads
* needed to have possibility of sending multiple types of 
messages, but ignoring these, not listened to (rather than 
throwing messageMismatch). IMHO there should be no message 
buffering, and throwing messages not listened on.
* had to define some possibility of thread discharging, based on 
constraints fired after each in-thread message handling
    void poll(bool delegate(Variant msg) condition);
    void poll(bool delegate() condition);
* needed to implement some form of message filters (like windows 
file system minifilters), which might sequentially act with 
blocking or passing message for multiple-listeners handling

i still need to add:
* because every message might have multiple listeners, it should 
be read only and shared between them
* there should be some kind of standard scheduler, which could be 
replaced later

Anyways, i think it's a great model of multithreading, and 
enjoyed working with std.concurrency.



More information about the Digitalmars-d mailing list