digitalmars.D - Time computation in receiveTimeout()
- Eitan Frachtenberg (22/22) Oct 25 2010 Not sure if this is a bug, but the behavior is very confusing. The follo...
Not sure if this is a bug, but the behavior is very confusing. The followin=
g code works correctly (that is, prints 3--4 lines). But if you change the =
timeout parameter to 100ms, I expect it to print around 30 lines--not 340,0=
00!
Any clues?
Thanks,
--Eitan.
import std.concurrency, std.stdio, core.thread;
void thrd() {
bool done =3D false;
int count =3D 0;
while (!done) {
receiveTimeout(1000, (int) { done =3D true; });
writeln("count: ", ++count);
}
}
void main() {
auto th =3D spawn(&thrd);
Thread.sleep(30_000_000);
send(th, 1);
Thread.sleep(10_000_000);
}
Oct 25 2010








Eitan Frachtenberg <etc facebook.com>