[ Compact ]
public class Poll
A Poll keeps track of file descriptors much like fd_set (used with
select) or a struct pollfd array (used
Once created with Poll, the set can be used to wait for file
descriptors to be readable and/or writeable. It is possible to make this wait be controlled by specifying
true for the
controllable flag when creating the set (or later calling
New file descriptors are added to the set using add_fd, and removed using
remove_fd. Controlling which file descriptors should be waited for to
become readable and/or writeable are done using ctl_read and
Use wait to wait for the file descriptors to actually become readable and/or
writeable, or to timeout if no file descriptor is available in time. The wait can be controlled by calling
Once the file descriptor set has been waited for, one can use
has_closed to see if the file descriptor has been closed,
has_error to see if it has generated an error, can_read to
see if it is possible to read from the file descriptor, and can_write
to see if it is possible to write to it.
- public bool add_fd (PollFD fd)
Add a file descriptor to the file descriptor set.
- public void get_read_gpollfd (PollFD fd)
Get a GPollFD for the reading part of the control socket.
- public bool read_control ()
Read a byte from the control socket of the controllable
- public bool remove_fd (PollFD fd)
Remove a file descriptor from the file descriptor set.
- public void restart ()
Restart any wait
that is in progress.
- public bool set_controllable (bool controllable)
true, this function ensures
that future calls to wait will be affected by
- public void set_flushing (bool flushing)
true, this function ensures that
current and future calls to wait will return -1, with errno set to EBUSY.
- public int wait (ClockTime timeout)
Wait for activity on the file descriptors in
- public bool write_control ()
Write a byte to the control socket of the controllable