Next: posix fd device, Previous: posix fd select, Up: posix fd [Index]
The poll
function is an alternative to the select
function: it allows to wait for events on file descriptors. Meaningless
example:
#!vicare (import (vicare) (prefix (vicare posix) px.) (vicare platform constants)) (define-values (in ou) (px.pipe)) (px.write ou '#vu8(1)) (define vec `#(#(,in ,POLLIN 0) #(,ou ,POLLOUT 0))) (px.poll vec 10) ⇒ 2 vec ⇒ `#(#(,in ,POLLIN ,POLLIN) #(,ou ,POLLOUT ,POLLOUT))
Interface to the C function poll()
, (*manpages*)Wait for some
event on a file descriptor. Poll for events the file descriptors
selected by fds; timeout must be an exact integer
representing the timeout in milliseconds. If successful: return the
number of file descriptors ready for an event, else raise an exception.
fds must be a vector of vectors each having 3 elements: a
fixnum representing the file descriptor, a fixnum representing the
events
field of a struct pollfd
, a fixnum representing the
revents
field of a struct pollfd
. On successful return:
the third element of the subvectors is mutated to represent the events
for which the file descriptor is ready.