2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

poll-loop: Enable checking whether a FD caused a wakeup.

Each time we run through the poll loop, we check all file descriptors
that we were waiting on to see if there is data available.  However,
this requires a system call and poll already provides information on
which FDs caused the wakeup so it is inefficient as the number of
active FDs grows.  This provides a way to check whether a given FD
has data.
This commit is contained in:
Jesse Gross
2011-07-31 14:47:32 -07:00
parent be8194bb59
commit 1e276d1a10
4 changed files with 41 additions and 4 deletions

View File

@@ -668,6 +668,14 @@ nl_sock_wait(const struct nl_sock *sock, short int events)
poll_fd_wait(sock->fd, events);
}
/* Checks whether this socket caused a wakeup in the previous run of the poll
* loop. */
short int
nl_sock_woke(const struct nl_sock *sock)
{
return poll_fd_woke(sock->fd);
}
/* Returns the PID associated with this socket. */
uint32_t
nl_sock_pid(const struct nl_sock *sock)