Poll
Object Hierarchy:
Description:
[ Compact ]
public class Poll
A Poll keeps track of file descriptors much like fd_set (used with select
) or a struct pollfd array
(used with poll
).
Once created with Poll, the set can be used to wait for file
descriptors to be readable and/or writable. It is possible to make this wait be controlled by specifying true
for the
controllable
flag when creating the set (or later calling
set_controllable).
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 writable are done using fd_ctl_read, fd_ctl_write and fd_ctl_pri.
Use wait to wait for the file descriptors to actually become readable and/or writable, or to timeout if no file descriptor is available in time. The wait can be controlled by calling restart and set_flushing.
Once the file descriptor set has been waited for, one can use fd_has_closed to see if the file descriptor has been closed, fd_has_error to see if it has generated an error, fd_can_read to see if it is possible to read from the file descriptor, and fd_can_write to see if it is possible to write to it.