[project @ 2002-03-12 11:50:02 by simonmar]
authorsimonmar <unknown>
Tue, 12 Mar 2002 11:51:07 +0000 (11:51 +0000)
committersimonmar <unknown>
Tue, 12 Mar 2002 11:51:07 +0000 (11:51 +0000)
commitf762be1b5a12b215595acdfb0343a6161e1a0e86
treed8eb56efadb186c5492118db3c87f8fbdf4f2f2a
parent44aa6bcb3941586a4fef9c1b84fce98ad4ef975c
[project @ 2002-03-12 11:50:02 by simonmar]
Main threads are now not kept alive artificially, so it is possible
for a main thread to be sent the BlockedOnDeadMVar exception.  Main
threads are no longer GC roots.

This involved cleaning up the weak pointer processing somewhat, and
separating the processing of real weak pointers from the processing of
the all_threads list (which can be thought of as "weaker pointers": a
finalizer can keep a blocked thread alive, but not vice-versa).  The
new story is described in a detailed comment in GC.c.

One interesting consequence is that it's much harder to get a Deadlock
exception now - many deadlock situations involving main threads will
turn into BlockedOnDeadMVar situations instead.  For example, if there
are a group of threads in a circular deadlock, then they will all be
sent BlockedOnDeadMVar simultaneously, whereas before if one of them
was the main thread it would be sent Deadlock.  It's really hard to
get Deadlock now - you have to somehow keep an MVar independently
reachable, eg. by using a StablePtr.
ghc/rts/GC.c
ghc/rts/GCCompact.c
ghc/rts/Schedule.c
ghc/rts/Schedule.h
ghc/rts/StoragePriv.h