Waiting on Sockets or File Descriptors

Peter Simons simons at cryp.to
Wed Feb 2 08:57:24 EST 2005


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? Like
select(2) or poll(2) would do?

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

I'm asking because I am fairly certain that other people
will run into this problem too. It would be nice to have a
more generic mechanism for this purpose, particularly if it
will (eventually) be supported by other implementations as
well. I mean, all the necessary infrastructure is bound to
be available in the run-time system anyway.

Peter



More information about the Glasgow-haskell-users mailing list