[Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds

Mitar mmitar at gmail.com
Mon Dec 13 03:19:51 CET 2010


Hi!

On Mon, Dec 13, 2010 at 2:14 AM, Antoine Latter <aslatter at gmail.com> 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-weight threads) and once some is triggered you spawn another
thread which deals with the event, while the original thread goes back
into the waiting. Or you can also send data over Chan to another
thread which then processes the even (if you need to serialize
processing).


Mitar



More information about the Haskell-Cafe mailing list