Hi,
the last few days, I tried to get an IO-Event system running with GHC i.e. trigger an IO action when there is data to read from a fd.
I looked at a few different implementations, but all of them have some downside.
* using select package
- This uses the select syscall. select is rather limited (fd cannot be >1024)
* using GHC.Event
- GHC.Event is broken in 7.10.1 (unless unsafeCoerce and a hacky trick are used)
- GHC.Event is GHC internal according to hackage
- Both Network libraries I looked at (networking (Network.Socket) and socket (System.Socket)) crash the application with GHC.Event
- with 7.8+ I didn't see a way to create your own EventManager, so it only works with -threaded
* using forkIO and threadWaitRead for each fd in a loop
- needs some kind of custom control structure around it
- uses a separate thread for each fd
- might become pretty awkward to handle multiple events
* using poll package