std.concurrency and module constructors
    japplegame 
    japplegame at gmail.com
       
    Fri May 11 05:56:03 PDT 2012
    
    
  
OS: Windows 7 64bit
Compiler: DMD32 D Compiler v2.059
Using spawn in module constructor causes very strange behavior.
import std.concurrency;
import std.stdio;
void main() {
}
void worker() {
   receiveOnly!OwnerTerminated;
}
static this() {
   writeln("module constructor");
   spawn(&worker);
}
static ~this() {
   writeln("module destructor");
}
prints in console:
module constructor
module destructor
module constructor
module destructor
module constructor
module constructor
module constructor
module constructor
module constructor
...
    
    
More information about the Digitalmars-d-learn
mailing list