[ovs-dev] [PATCH v2 1/3] poll-loop: Make poll_fd_wait_event() cross-platform.

Ben Pfaff blp at nicira.com
Mon Feb 10 21:04:07 UTC 2014


On Mon, Feb 10, 2014 at 12:54:50PM -0800, Ben Pfaff wrote:
> On Mon, Feb 10, 2014 at 11:16:20AM -0800, Gurucharan Shetty wrote:
> > This is helpful if we want to wait either on 'fd' for POSIX or
> > events for Windows.
> > 
> > For Windows, if both 'fd' and 'wevent' is specified, we associate
> > that event with the 'fd' using WSAEventSelect(). So any 'events'
> > on that 'fd' will wake us up from WaitForMultipleObjects().
> > 
> > CC: Linda Sun <lsun at vmware.com>
> > Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
> 
> I found the WSAEventSelect() documentation in MSDN really
> un-enlightening, but I'll take your word for it that this does
> something helpful.

One thing I did glean from the MSDN documentation is that if you do
WSAEventSelect() on a fd and then call some other function on that fd,
the latter can reset what WSAEventSelect() did.  That makes me wonder
whether we should avoid the resets by calling WSAEventSelect from the
first HMAP_FOR_EACH loop inside poll_block(), instead of from
poll_fd_wait_at(), simply to have less opportunity to screw ourselves
up.  (Also in theory we could reduce the number of calls to
WSAEventSelect() that way, when we call poll_fd_wait_at() more than
once on a single fd, but I doubt that's important in practice.)



More information about the dev mailing list