Not sure if this is a bug, but the behavior is very confusing. The following 
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,000!
Any clues?
Thanks,
--Eitan.



import std.concurrency, std.stdio, core.thread;

void thrd() {
  bool done = false;
  int count = 0;

  while (!done) {
    receiveTimeout(1000, (int) { done = true; });
    writeln("count: ", ++count);
  }
}

void main() {
  auto th = spawn(&thrd);
  Thread.sleep(30_000_000);
  send(th, 1);
  Thread.sleep(10_000_000);
}

Reply via email to