unix::poll
Index
Types
type event = enum i16 {
POLLIN = 1,
POLLPRI = 2,
POLLOUT = 4,
POLLERR = 8,
POLLHUP = 16,
};
type pollfd = struct {
fd: io::file,
events: i16,
revents: i16,
};
Errors
type error = !errors::error;
Constants
def INDEF: time::duration = -1;
def NONBLOCK: time::duration = 0;
Functions
fn poll(fds: []pollfd, timeout: time::duration) (uint | error);
fn strerror(err: error) const str;
Types
type event
type event = enum i16 {
POLLIN = 1,
POLLPRI = 2,
POLLOUT = 4,
POLLERR = 8,
POLLHUP = 16,
};
Events bitfield for the events and revents field of pollfd.
type pollfd
type pollfd = struct {
fd: io::file,
events: i16,
revents: i16,
};
A single file descriptor to be polled.
Errors
type error
type error = !errors::error;
All error types that can be returned from poll.
Constants
def INDEF
def INDEF: time::duration = -1;
Pass this time::duration to poll to cause it wait indefinitely for the next event.
def NONBLOCK
def NONBLOCK: time::duration = 0;
Pass this time::duration to poll to cause it to return immediately if no events are available.
Functions
fn poll
fn poll(fds: []pollfd, timeout: time::duration) (uint | error);
Polls for the desired events on a slice of pollfds, blocking until an event is available, or the timeout expires. Set the timeout to INDEF to block forever, or NONBLOCK to return immediately if no events are available. Returns the number of pollfd items which have events, i.e. those which have revents set to a nonzero value.
fn strerror
fn strerror(err: error) const str;
Converts an error into a human-friendly string representation.