qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 10/10] aio-win32: add support for sockets


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 10/10] aio-win32: add support for sockets
Date: Fri, 12 Sep 2014 13:51:35 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Fri, Sep 12, 2014 at 09:39:16AM +0800, TeLeMan wrote:
> On Wed, Jul 9, 2014 at 5:53 PM, Paolo Bonzini <address@hidden> wrote:
> > Uses the same select/WSAEventSelect scheme as main-loop.c.
> > WSAEventSelect() is edge-triggered, so it cannot be used
> > directly, but it is still used as a way to exit from a
> > blocking g_poll().
> >
> > Before g_poll() is called, we poll sockets with a non-blocking
> > select() to achieve the level-triggered semantics we require:
> > if a socket is ready, the g_poll() is made non-blocking too.
> >
> > Based on a patch from Or Goshen.
> >
> > Signed-off-by: Paolo Bonzini <address@hidden>
> > ---
> >  aio-win32.c         | 150 
> > ++++++++++++++++++++++++++++++++++++++++++++++++++--
> >  block/Makefile.objs |   2 -
> >  include/block/aio.h |   2 -
> >  3 files changed, 145 insertions(+), 9 deletions(-)
> >
> > diff --git a/aio-win32.c b/aio-win32.c
> > index 4542270..61e3d2d 100644
> > --- a/aio-win32.c
> > +++ b/aio-win32.c
> 
> > @@ -183,6 +318,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
> >
> >      /* wait until next event */
> >      while (count > 0) {
> > +        HANDLE event;
> >          int ret;
> >
> >          timeout = blocking
> > @@ -196,13 +332,17 @@ bool aio_poll(AioContext *ctx, bool blocking)
> >          first = false;
> >
> >          /* if we have any signaled events, dispatch event */
> > -        if ((DWORD) (ret - WAIT_OBJECT_0) >= count) {
> > +        event = NULL;
> > +        if ((DWORD) (ret - WAIT_OBJECT_0) < count) {
> > +            event = events[ret - WAIT_OBJECT_0];
> > +        } else if (!have_select_revents) {
> 
> when (ret - WAIT_OBJECT_0) >= count and have_select_revents is true,
> the following events[ret - WAIT_OBJECT_0] will be overflowed.

Thanks for your review.  Paolo has hardware problems and is travelling
next week.

Are you able to send patches to fix these issues?

Thanks,
Stefan

Attachment: pgpcfmOlqyj9s.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]