[project @ 2002-12-10 13:38:40 by wolfgang]
authorwolfgang <unknown>
Tue, 10 Dec 2002 13:38:40 +0000 (13:38 +0000)
committerwolfgang <unknown>
Tue, 10 Dec 2002 13:38:40 +0000 (13:38 +0000)
commit8a8eee36f8bdcefbe05d04f62d481f1d612bde6b
treee9611156db3becef9a0367ba660a8be42680a376
parentd482ad51c9051d6eb9fbcafd90362949db29f374
[project @ 2002-12-10 13:38:40 by wolfgang]
Fix a race condition/possible deadlock in the threaded rts:

If a callback into haskell finished before waitThread_() was called,
the signal was lost  ans waitThread_() waited indefinitely.

Solution: Don't release the sched_mutex between calls to scheduleThread_
and waitThread_.

Please note that the scheduler API function waitThread is still possibly
affected by this race condition. It's used in rts_mainEvalIO (I think that's
safe) and in finishAllThreads (this looks dangerous, but finishAllThreads is
never used).
ghc/rts/Schedule.c