Ah, that makes sense for the Python version.

The Python docs were sparse, so I wasn't sure.

On Tue, Aug 22, 2017 at 8:35 AM, Alin Balutoiu
<[email protected]> wrote:
> 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:[email protected]]
>> Sent: Tuesday, August 22, 2017 2:22 PM
>> To: Alin Balutoiu <[email protected]>
>> Cc: [email protected]
>> Subject: Re: [ovs-dev] [PATCH] windows, python: Fix event type returned
>> from poller
>>
>> On Tue, Aug 22, 2017 at 6:47 AM, Alin Balutoiu
>> <[email protected]> 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 <[email protected]>
>> > ---
>> >  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 <[email protected]>
>>
>> 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



-- 
Russell Bryant
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to