#5443: Errors when shutting down the event manager loop
---------------------------------+------------------------------------------
Reporter: basvandijk | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.2.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
As explained in
[http://thread.gmane.org/gmane.comp.lang.haskell.glasgow.user/20573 this
thread on the GHC list] I use the GHC event manager in my
[https://github.com/basvandijk/usb 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`.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5443>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs