why spawn crash?
mzfhhhh via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jan 22 19:20:22 PST 2015
i wrote a test code:
void worker(int firstNumber)
{
Thread.sleep(1.msecs);
}
void main()
{
foreach (i; 1 .. 1000) {
spawn(&worker, i );
writeln(i);
}
thread_joinAll();
writeln("ok");
}
sometimes it's ok,sometimes it's crashed ! why ?
here is one of times callstack message:
test.exe!_free()
test.exe!_fwide()
test.exe!_fwide()
test.exe!__ReleaseSemaphore()
test.exe!_fwide()
> test.exe!main at __modctor() 行 3
test.exe!rt at minfo@__T14runModuleFuncsS482rt5minfo11ModuleGroup11runTlsCtorsMFZ9__lambda1Z at runModuleFuncs()
test.exe!___threadstartex at 4()
More information about the Digitalmars-d-learn
mailing list