On Sunday 23 January 2011 20:34:16 Adam Conner-Sax wrote:
> The attached code usually hangs (running on OSX, dmd 2.051).
> It uses spawn to create a new thread. All the thread does is create a
> large array of doubles. In one case it uses the Array!double from
> std.container. In the other case it uses the built in dynamic double.
> It declares the array, sets the length, then sends a message to main
> saying it is finished and exits.
> The Array!double case always runs fine. The built-in dynamic array case
> usually hangs, though not always in the same place.
> And the array has to be sufficiently big (in my case 200000 or bigger I
> think) or the problem doesn't occur.
> I've no idea why. It took me a *long* time to find this since it
> manifested as very mysterious hanging in a more complex piece of threaded
> code. Now I've switched to using Array!double in my code and it all works
> (An example run)
> Spawned foo 1
> Spawned foo 2
> Spawned foo 3
> Spawned foo 4
> Finished foo 1
> Finished foo 2
> Finished foo 3
> Finished foo 4
> Spawned bar 1
> Spawned bar 2
> Spawned bar 3
> (stays here without finishing)
> begin 644 spawn.d
Please don't post to the bug list. Ask about bugs on D.Learn or D, or just
report them in the tracker. This list is only meant for receiving messages from
the bug tracker.
There are several spawn bugs:
This one seems a likely culprit:
- Jonathan M Davis