socket :: NativeSocket :: native_poll
Signature: int poll(struct pollfd fds[], nfds_t nfds, int timeout);
Official documentation of the poll function:
The poll() function provides applications with a mechanism for multiplexing input/output over a set of file descriptors. For each member of the array pointed to by fds, poll() shall examine the given file descriptor for the event(s) specified in events. The number of pollfd structures in the fds array is specified by nfds. The poll() function shall identify those file descriptors on which an application can read or write data, or on which certain events have occurred. The fds argument specifies the file descriptors to be examined and the events of interest for each file descriptor. It is a pointer to an array with one member for each open file descriptor of interest. The array's members are pollfd structures within which fd specifies an open file descriptor and events and revents are bitmasks constructed by OR'ing a combination of the pollfd flags.
# Call to the poll function of the C socket
#
# Signature:
# int poll(struct pollfd fds[], nfds_t nfds, int timeout);
#
# Official documentation of the poll function:
#
# The poll() function provides applications with a mechanism for multiplexing input/output over a set of file descriptors.
# For each member of the array pointed to by fds, poll() shall examine the given file descriptor for the event(s) specified in events.
# The number of pollfd structures in the fds array is specified by nfds.
# The poll() function shall identify those file descriptors on which an application can read or write data, or on which certain events have occurred.
# The fds argument specifies the file descriptors to be examined and the events of interest for each file descriptor.
# It is a pointer to an array with one member for each open file descriptor of interest.
# The array's members are pollfd structures within which fd specifies an open file descriptor and events and revents are bitmasks constructed by
# OR'ing a combination of the pollfd flags.
private fun native_poll(filedesc: NativeSocketPollFD, timeout: Int): Int `{
int poll_return = poll(filedesc, 1, timeout);
return poll_return;
`}
lib/socket/socket_c.nit:190,2--208,3