select- Wrap the select(2) POSIX function

Safe HaskellNone



Pure interface to fd_set.

As far as I can tell, the data structure and functions in System.Posix.IO.Select.FdSet are referentially transparent, and it should be OK to escape the IO monad. However, POSIX requires that all operations on fd_sets are done with valid file descriptors. This can potentially be hard to ensure with lazy evaluation in a pure setting, so for now this module bears the unsafe label. On Linux, invalid file descriptors seem to be just fine.

See System.Posix.IO.Select.FdSet for documentation in general. All functions here essentially just add unsafePerformIO.



inList :: [Fd] -> FdSet -> [Fd]Source

unsafeToList :: FdSet -> [Fd]Source

This converts an FdSet to a list by testing every file descriptor in range for membership, which tends to involve invalid file descriptors, giving undefined behavior according to POSIX. Use inList if possible.