why spawn crash?
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 23 04:52:44 PST 2015
On 1/22/15 10:20 PM, mzfhhhh wrote:
> 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()
>
That sounds like a bug in stdio. fwide is the horrible attempt of C
stdio to do wide character output.
-Steve
More information about the Digitalmars-d-learn
mailing list