How to synchronously shutdown the event manager loop

Bas van Dijk v.dijk.bas at gmail.com
Wed Aug 31 01:11:12 CEST 2011


On 31 August 2011 00:15, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> I see what I can do. I'm first going to export the 'finished' function
> from GHC.Event and use that to wait till the loop finishes and see if
> that solves my problem.

Waiting till the loop finishes doesn't solve the problem.

Here's an isolated program with the same problem that doesn't use the
usb library:

import Control.Concurrent
import GHC.Event

main = do
  em <- new
  forkIO $ loop em
  threadDelay 2000000
  shutdown em
  threadDelay 2000000

When executed it prints:

example: ioManagerWakeup: write: Bad file descriptor
example: ioManagerDie: write: Bad file descriptor

So it seems like a bug in GHC. I will create a ticket in the morning.

Regards,

Bas



More information about the Glasgow-haskell-users mailing list