www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - std.concurrency and module constructors

reply "japplegame" <japplegame gmail.com> writes:
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
...
May 11 2012
parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Fri, 11 May 2012 07:34:46 -0400, japplegame <japplegame gmail.com>  
wrote:

 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
 ...
This list is for bugzilla to post to, it is not for general bug reports or help requests. I really wish it was disabled to post to from everyone but bugzilla. Please repost your issue to D.learn. Thanks -Steve
May 11 2012
parent "japplegame" <japplegame gmail.com> writes:
Oh, I'm sorry. My mistake.
May 11 2012