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@__modctor() 行 3
test.exe!rt@minfo@__T14runModuleFuncsS482rt5minfo11ModuleGroup11runTlsCtorsMFZ9__lambda1Z@runModuleFuncs()
test.exe!___threadstartex@4()