select- Wrap the select(2) POSIX function

Safe HaskellNone



Interface to select(2). The arguments to the functions exposed here must fulfill the same requirements as the arguments for select itself; see the man page.

If the select call made by any of these functions is interrupted (select returning -1 and errno being EINTR) before the given time has elapsed, the call will be retried. If the specified amount of time has passed and select is still being interrupted, the functions below will make one last attempt with timeout zero. If that call too is interrupted, behavior will be as if select returned an error.



select :: FdSet -> FdSet -> FdSet -> Timeout -> IO ResultSource

The first FdSet is watched for readiness to read, the second for readiness to write, and the third for exceptions. The Timeout argument specifies when select should time out (if at all).

select' :: [Fd] -> [Fd] -> [Fd] -> Timeout -> IO (Maybe ([Fd], [Fd], [Fd]))Source

A simpler version of select that uses file descriptor lists instead of FdSets. Nothing is returned in case select gives an error, otherwise Just (rfds, wfds, efds) is returned, where rfds, wfds and efds are lists of ready file descriptors (they may be empty, such as in the case of select timing out).

select'' :: [Fd] -> [Fd] -> [Fd] -> Timeout -> IO CIntSource

This simpler version of select takes the same arguments as select', but only returns the return value of select(2) itself (i.e. -1 on error, otherwise the number of ready file descriptors in total).