std.concurrency: The fate of unmatched messages
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jul 10 19:15:02 PDT 2015
On Sat, 11 Jul 2015 01:52:23 +0000, E.S. Quinn wrote:
> On Friday, 10 July 2015 at 23:39:30 UTC, ketmar wrote:
>> 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
>
> The thing is, I want to do receive() in two separate places, and I want
> each receive() call to leave the other's messages alone, not drop them.
so simply don't receive the messages you don't need right now. as i said,
`receive()` doesn't look to top message only, it scans the whole mailbox,
trying to find a message that matches. you can use `receiveTimeout()` to
do nothing if there are no suitable messages. you can also adjust mailbox
size and mode.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150711/74ef15a2/attachment.sig>
More information about the Digitalmars-d-learn
mailing list