www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Time computation in receiveTimeout()

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=
Any clues?

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);
  send(th, 1);
Oct 25 2010