Endless static this call when used a thread in it
Daniel Kozák via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jan 13 06:00:22 PST 2015
V Tue, 13 Jan 2015 13:53:09 +0000
tcak via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
napsáno:
> I have written the following code:
>
> test.d
> ==============================
> import core.thread;
> import std.stdio;
>
> void threadFunc(){
> writeln("Thread func");
> }
>
> public static this(){
> auto t = new Thread( &threadFunc );
> t.start();
>
> writeln("Static init");
> }
>
> void main(){
> writeln("End of main");
> }
>
>
> run
> ======================
> rdmd test.d
>
>
> result
> ======================
> Static init
> Thread func
> Static init
> Thread func
> Static init
> Thread func
> Static init
> Thread func
> Static init
> Thread func
> Static init
> Thread func
> Static init
> Thread func
> Static init
> Thread func
> Sta...
>
> Is this normal, what's happening?
try
shared static this(){
...
instead of
public static this(){
More information about the Digitalmars-d-learn
mailing list