threaded rts deadlock
Sigbjorn Finne
sof at galois.com
Wed Jun 19 16:59:55 EDT 2002
Hi,
thanks for a fine report; well spotted. I believe the
Scheduler changes I've just checked in avoids
running into this race condition.
--sigbjorn
----- Original Message -----
From: "Wolfgang Thaller" <wolfgang.thaller at gmx.net>
To: <glasgow-haskell-bugs at haskell.org>
Sent: Tuesday, June 18, 2002 11:47
Subject: threaded rts deadlock
> 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