Looking at the implementation of WaitForMultipleObjects in Python it looks that
the call will raise an exception if WAIT_FAILED is returned. This case is 
treated by
the try/except block around the WaitForMultipleObjects function.

Thanks,
Alin Balutoiu.

> -----Original Message-----
> From: Russell Bryant [mailto:russ...@ovn.org]
> Sent: Tuesday, August 22, 2017 2:22 PM
> To: Alin Balutoiu <abalut...@cloudbasesolutions.com>
> Cc: d...@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH] windows, python: Fix event type returned
> from poller
> 
> On Tue, Aug 22, 2017 at 6:47 AM, Alin Balutoiu
> <abalut...@cloudbasesolutions.com> wrote:
> > The function poll from poller should return a list of tuples
> > containing the events and their types.
> >
> > On Windows the event type is not returned at the moment.
> > Instead of returning zero all the time, we check to see the type of
> > event and we set it accordingly before returning the list.
> >
> > This is used only for debugging purposes inside the function
> > "__log_wakeup" later on.
> >
> > Signed-off-by: Alin Balutoiu <abalut...@cloudbasesolutions.com>
> > ---
> >  python/ovs/poller.py | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/python/ovs/poller.py b/python/ovs/poller.py index
> > 809e512..2f3fcf9 100644
> > --- a/python/ovs/poller.py
> > +++ b/python/ovs/poller.py
> > @@ -112,7 +112,14 @@ class _SelectSelect(object):
> >              if retval == winutils.winerror.WAIT_TIMEOUT:
> >                  return []
> >
> > -            return [(events[retval], 0)]
> > +            if events[retval] in self.rlist:
> > +                revent = POLLIN
> > +            elif events[retval] in self.wlist:
> > +                revent = POLLOUT
> > +            else:
> > +                revent = POLLERR
> > +
> > +            return [(events[retval], revent)]
> >          else:
> >              if timeout == -1:
> >                  # epoll uses -1 for infinite timeout, select uses None.
> 
> Acked-by: Russell Bryant <russ...@ovn.org>
> 
> I tried looking up docs of WaitForMultipleObjects to look at possible return
> values.  It looks like WAIT_FAILED could be returned and it would cause an
> exception when used as the index to events.  If that's right, it was true
> before the patch as well, though.
> 
> --
> Russell Bryant
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to