On Fri, 10 Jul 2015 19:39:24 +0000, E.S. Quinn wrote:

> the documentation i can find for std.concurrency mentions what happens
> when one receive() call gets a message it doesn't understand.

that `receive()` will not get such a message. `receive()` scans the whole 
mailbox to find the message it can process, and process only that, 
leaving other messages in mailbox.


> And if the latter, is there any way to actually give a single thread
> multiple mailboxes?

why do you want that? you can receive any message with `receive`, see the 
documentation[1]:

"If a delegate that accepts a std.variant.Variant is included as the last 
argument to receive, it will match any message that was not matched by an 
earlier delegate. If more than one argument is sent, the Variant will 
contain a std.typecons.Tuple of all values sent."

    receive(
        (int i) { writeln("Received an int."); },
        (float f) { writeln("Received a float."); },
        (Variant v) { writeln("Received some other type."); }
    );

this way your `receive` will get all messages. simply do nothing in 
`Variant` handler to drop messages you don't want to process.


[1] http://dlang.org/phobos/std_concurrency.html#.receive

Attachment: signature.asc
Description: PGP signature

Reply via email to