On Thursday, 24 January 2013 at 10:57:26 UTC, Stephan wrote:
Hi,
I am getting totally confused by Exceptions and Multi-threading
with std.concurrency.
I have a simple setup:
- the main thread spawns several child-threads
- each child-thread performs a task
- each child-thread sends their result back to the main
thread and finishes.
- the main thread uses receiveOnly to get the message.
To spawn the child-threads I use spawn, not spawnLinked.
Nevertheless, in all runs, at some point the program finishes
with an uncaught LinkTerminated exception!
I am confused, because I thought, that LinkTerminated can only
happen if the child-threads are started with spawnLinked. In
small test programs, I don't get LinkTerminated exceptions if a
child thread crashes. So my first question is: Where does the
LinkTerminated Exception come from, when the only functions
from std.concurrency that I use are "spawn" and "receiveOnly".
Thanks for any clarification!
I have had the same problem, especially when creating large
numbers of threads (several hundred)