Errors when shutting down the event manager loop
|Reported by:||basvandijk||Owned by:||tibbe|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
As explained in this thread on the GHC list I use the GHC event manager in my usb library. I create my own EventManager and start a thread which runs the event manager loop. When the library is finalized I automatically shutdown the loop. However this causes error messages from the RTS to be printed.
The following program shows the problem in isolation:
import Control.Concurrent import GHC.Event main = do em <- new tid <- forkIO $ loop em threadDelay 2000000 shutdown em -- Note that 'killThread tid' has the same effect. threadDelay 2000000
Make sure to build it with -threaded enabled:
$ ghc -threaded --make eventManagerBug.hs
Running it gives the following errors:
$ ./eventManagerBug example: ioManagerWakeup: write: Bad file descriptor example: ioManagerDie: write: Bad file descriptor
Note that these errors are printed in the ioManagerWakeup function in rts/posix/Signals.c.