threaded rts deadlock
Wolfgang Thaller
wolfgang.thaller at gmx.net
Tue Jun 18 14:47:14 EDT 2002
If a callback into Haskell code finishes very quickly, a deadlock
occurs. Adding a small delay helps.
This is what I think happens:
rts_evalIO creates a haskell thread
rts_evalIO calls scheduleExtThread to spawn a new OS thread. When the
callback is finished, schedule() calls broadcastCondition on m->wakeup.
But because the callback took very little time, this happens _before_
rts_evalIO calls waitThread.
waitThread is responsible for initializing m->wakeup and waiting for a
broadcast, but broadcastCondition might already have been called
_before_ that. It won't be called again, so nothing happens anymore...
Some locking to prevent this race condition is probably necessary...
Cheers,
Wolfgang
More information about the Glasgow-haskell-bugs
mailing list