Re: [Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds

2010-12-13 Thread Johan Tibell
On Mon, Dec 13, 2010 at 9:06 AM, Mathijs Kwik wrote: > Just to reply to myself once again, > > System.Event (which isn't hidden) re-exports (un)registerFd and other > functions I need for this. > So I can implement all this myself. The only thing I can't do is ask > the RTS's eventmanager to watch

Re: [Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds

2010-12-13 Thread Mathijs Kwik
Just to reply to myself once again, System.Event (which isn't hidden) re-exports (un)registerFd and other functions I need for this. So I can implement all this myself. The only thing I can't do is ask the RTS's eventmanager to watch the fds for me, but I can just create my own ("new" constructor

Re: [Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds

2010-12-12 Thread Mathijs Kwik
Yep, that's like the workaround I'm using right now. I create an empty mvar, fire up 2 threads that will wait for an fd and tryPutMVar afterwards. My original thread justs gets the MVar to wait for any of the 2 fd-waiting-threads to complete. But however light threads may be, I still think this mig

Re: [Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds

2010-12-12 Thread Johan Tibell
On Mon, Dec 13, 2010 at 1:37 AM, Mathijs Kwik wrote: > Hi all, > > I read the paper about the new ghc7 event handling IO manager goodies. > This is all very exciting stuff. I didn't know GHC's RTS had these > smart async-IO facilities. > The paper pointed me at threadWaitRead/threadWaitWrite. > Wh

Re: [Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds

2010-12-12 Thread Mitar
Hi! On Mon, Dec 13, 2010 at 2:14 AM, Antoine Latter wrote: > Can you do it with forkIO? That is, have two light-weight threads, > each waiting on a different fd, which perform the same action when one > of them wakes up. Or you could wait for each fd in its own thread (those are really light-wei

Re: [Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds

2010-12-12 Thread Antoine Latter
On Sun, Dec 12, 2010 at 6:37 PM, Mathijs Kwik wrote: > Hi all, > > I read the paper about the new ghc7 event handling IO manager goodies. > This is all very exciting stuff. I didn't know GHC's RTS had these > smart async-IO facilities. > The paper pointed me at threadWaitRead/threadWaitWrite. > Wh

[Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds

2010-12-12 Thread Mathijs Kwik
Hi all, I read the paper about the new ghc7 event handling IO manager goodies. This is all very exciting stuff. I didn't know GHC's RTS had these smart async-IO facilities. The paper pointed me at threadWaitRead/threadWaitWrite. While very nice the way they are, I would also like to be able to wai