[project @ 2004-03-01 14:18:35 by simonmar]
authorsimonmar <unknown>
Mon, 1 Mar 2004 14:18:36 +0000 (14:18 +0000)
committersimonmar <unknown>
Mon, 1 Mar 2004 14:18:36 +0000 (14:18 +0000)
commita20ec0ced36bca7cd0594528922dbe31a6186eae
treef569e827cb7903e995e6aa63259bf13c1fc988dd
parent07e22b02f96a06ca7186f773dfc7c08f478a6877
[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).
ghc/includes/TSO.h
ghc/rts/Exception.h
ghc/rts/Schedule.c
ghc/rts/Schedule.h