Waiting on Sockets or File Descriptors

Tomasz Zielonka tomasz.zielonka at gmail.com
Wed Feb 2 10:48:32 EST 2005

On Wed, Feb 02, 2005 at 05:58:58AM -0800, Peter Simons wrote:
> Tomasz Zielonka writes:
>  >     threadWaitRead :: Int -> IO ()
>  >     threadWaitWrite :: Int -> IO ()
> Thanks for the pointer!
> Am I correct in assuming that there is no "more high-level"
> mechanism for scheduling more than one file descriptor?

This is the most high-level mechanism I can imagine.

> Like select(2) or poll(2) would do?

You seem to what something low-level.

> I guess, I could implement it on top of those functions with
> some clever forkIO'ing, but I wonder whether that's
> particularly efficient?

This translates to select() (or poll()), but yes, you'll pay some
price for creating and scheduling Haskell threads.

Best regards,

More information about the Glasgow-haskell-users mailing list