[project @ 2004-03-01 14:18:35 by simonmar]
Threaded RTS improvements: - Make the main_threads list doubly linked. Have threads remove themselves from this list when they complete, rather than searching for completed main threads each time around the scheduler loop. This removes an O(n) loop from the scheduler, but adds some new constraints (basically completed threads must remain on the run queue until dealt with, including threads which have been killed by an async exception). - Add a pointer from the TSO to the StgMainThread struct, for main threads. This avoids a number of places where we had to traverse the list of main threads to find the right one, including one place in the scheduler loop. Adding a field to a TSO is cheap. - taskStart: we should be resetting the startingWorkerThread flag in here. Not sure why we aren't; maybe this got lost at some point. - Use the BlockedOnCCall flags in the non-threaded RTS too. Q: what should happen if a thread does a foreign call which re-enters the RTS, and then sends an async exception to the original thread? Answer: it should deadlock, which it does in the threaded RTS, and this commit makes it do so in the non-threaded RTS too (see testsuite/tests/concurrent/should_run/conc040.hs).