[ovs-dev] [PATCH] pool-loop: windows poll_block implementation
Ben Pfaff
blp at nicira.com
Wed Dec 18 00:46:44 UTC 2013
On Thu, Dec 12, 2013 at 04:28:12PM -0800, Linda Sun wrote:
> Use WaitForMultipleObjects for polling on windows. This works on all kinds
> of objects, e.g. sockets, files, especially ioctl calls to the kernel.
> One additional paramater is passed down in poll_fd_wait() to help
> WaitForMultipleObjects.
> latch is signaled with event, to be waited/polled by WaitForMultipleObjects()
> as well.
> Changed array of fds to hmap to check for duplicate fds.
>
> Signed-off-by: Linda Sun <lsun at vmware.com>
Hi Linda, thanks for the second version.
GCC reports:
../lib/poll-loop.c: In function 'poll_block':
../lib/poll-loop.c:304:16: error: unused variable 'i' [-Werror=unused-variable]
../lib/timeval.c: In function 'time_poll':
../lib/timeval.c:235:56: error: unused parameter 'handles' [-Werror=unused-parameter]
../lib/stream-ssl.c: In function 'ssl_run_wait':
../lib/stream-ssl.c:694:66: error: macro "poll_fd_wait" requires 3 arguments, but only 2 given
../lib/stream-ssl.c:694:9: error: 'poll_fd_wait' undeclared (first use in this function)
../lib/stream-ssl.c:694:9: note: each undeclared identifier is reported only once for each function it appears in
../lib/stream-ssl.c: In function 'ssl_wait':
../lib/stream-ssl.c:710:47: error: macro "poll_fd_wait" requires 3 arguments, but only 2 given
../lib/stream-ssl.c:710:17: error: 'poll_fd_wait' undeclared (first use in this function)
../lib/stream-ssl.c:717:70: error: macro "poll_fd_wait" requires 3 arguments, but only 2 given
../lib/stream-ssl.c:728:70: error: macro "poll_fd_wait" requires 3 arguments, but only 2 given
../lib/stream-ssl.c: In function 'pssl_wait':
../lib/stream-ssl.c:854:34: error: macro "poll_fd_wait" requires 3 arguments, but only 2 given
../lib/stream-ssl.c:854:5: error: 'poll_fd_wait' undeclared (first use in this function)
../lib/stream-ssl.c:853:26: error: unused variable 'pssl' [-Werror=unused-variable]
../lib/stream-ssl.c: At top level:
../lib/stream-ssl.c:188:1: error: 'want_to_poll_events' defined but not used [-Werror=unused-function]
The subject should be "poll" loop, not "pool" loop.
I see that latch.c is completely different on Windows and Linux. I'd
rather have two separate sources files, then, such as latch-windows.c
and latch-unix.c, rather than one file with piles of ifdefs. I see
that Windows also wants different members in struct latch; I guess an
#ifdef in the header file is a reasonable way to do that.
Almost every caller of poll_fd_wait() passes 0 for wevent. I suggest
adding a new function for nonzero wevent rather than confusing
unix-oriented code readers. Either way, the comment on the function
that takes the wevent argument needs to explain what it means.
wevent is a uint32_t but poll_fd_wait_at() compares it to NULL.
Now that we're using an hmap, there's no need to keep an 'n_waiters'
member in poll_loop. (We can just use hmap_count(&loop->poll_nodes).)
Can we avoids allocating memory for wevents entirely outside of
Windows platforms?
It looks like time_poll() is trying to return a Windows error number
as if it were an errno value. I think that's going to cause trouble.
Please figure out some way to return an appropriate errno value.
Thanks,
Ben.
More information about the dev
mailing list