Function os::fs::poll::pselect

source · []
pub fn pselect(
    nfds: usize,
    read_fds: Option<&mut FdSet>,
    write_fds: Option<&mut FdSet>,
    exception_fds: Option<&mut FdSet>,
    timeout: Option<&TimeSpec>,
    sigmask: *const Signals
) -> isize
Expand description

Poll each of the file discriptors until certain events.

Arguments

  • nfds: the highest-numbered file descriptor in any of the three sets

  • read_fds: files to be watched to see if characters become available for reading

  • write_fds: files to be watched to see if characters become available for writing

  • except_fds: exceptional conditions

(For examples of some exceptional conditions, see the discussion of POLLPRI in [poll(2)].)

  • timeout: argument specifies the interval that pselect() should block waiting for a file descriptor to become ready

  • sigmask: the sigmask used by the process during the poll, as in ppoll

Return Value

  • On success, select() and pselect() return the number of file descriptors contained in the three returned descriptor sets (that is, the total number of bits that are set in readfds, writefds, exceptfds) which may be zero if the timeout expires before anything interesting happens.

  • On error, -1 is returned, the file descriptor sets are unmodified, and timeout becomes undefined.

  • If both fields of the timeval structure are zero, then select() returns immediately. (This is useful for polling.) If timeout is NULL (no timeout), select() can block indefinitely.