std.concurrency msg passing
Joshua Niehus
jm.niehus at gmail.com
Thu Oct 18 12:46:22 PDT 2012
On Thursday, 18 October 2012 at 17:33:04 UTC, cal wrote:
>> I can't see the bug? The receiver accepts a bool as an int,
> same way a normal function does. The timeout is long enough
> that foo gets a chance to send. If you want to stop the int
> receiver getting a bool, you could add another receiver with
> (bool) { // do nothing } or whatever before the (int) one,
> which will be a better match for the send.
I got myself into a situation where I dont know which will be
called first, the int or the bool and "when" the call happens
matters.
It was my assumption that "receiveTimeout(dur, (type){}); would
distinguish between a bool and an int like it does for float and
int. But I can see why it would treat true/false as 0/1, so not
a bug.
Anyway my current workaround is to define a few "Signal" structs
and use those instead:
struct SignalReady { blah }
struct SignalXDone { blah }
struct SignalYDone { blah }
Thanks for the reply.
More information about the Digitalmars-d-learn
mailing list