cvs commit: fptools/ghc/rts RtsAPI.c
simonmar at haskell.org
Tue Sep 28 11:08:59 EDT 2004
simonmar 2004/09/28 08:08:59 PDT
rts_evalStableIO: set rtsApiCapability to NULL *before* calling
scheduleWaitThread, matching the way the other eval_* functions do
The previous way lead to a suble race condition:
- thread A calls rts_evalIO, enters scheduleWaitThread()
(rtsApiCapability == NULL).
- thread B calls rts_evalStableIO, creates a main thread and enters
scheduleWaitThread() (rtsApiCapability == &MainCapability)
- thread A exits scheduleWaitThread, sees that rtsApiCapability is
non-NULL, and calls releaseCapability() on it. This is bogus,
because thread A doesn't actually hold the capability, and we've
done a double-release.
This scenario leads to assertion failures in a debug threaded RTS, and
probably crashes in a non-debug threaded RTS.
MERGE TO STABLE
Revision Changes Path
1.54 +3 -2 fptools/ghc/rts/RtsAPI.c
More information about the Cvs-ghc