From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSQKT-0002CK-F0 for qemu-devel@nongnu.org; Fri, 12 Sep 2014 08:52:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XSQKK-0001zp-CO for qemu-devel@nongnu.org; Fri, 12 Sep 2014 08:51:57 -0400 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:36196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSQKK-0001zh-50 for qemu-devel@nongnu.org; Fri, 12 Sep 2014 08:51:48 -0400 Received: by mail-wi0-f180.google.com with SMTP id ex7so558143wid.1 for ; Fri, 12 Sep 2014 05:51:46 -0700 (PDT) Date: Fri, 12 Sep 2014 13:51:35 +0100 From: Stefan Hajnoczi Message-ID: <20140912125135.GD6207@stefanha-thinkpad.redhat.com> References: <1404899590-24973-1-git-send-email-pbonzini@redhat.com> <1404899590-24973-11-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Xm/fll+QQv+hsKip" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 10/10] aio-win32: add support for sockets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: TeLeMan Cc: Paolo Bonzini , qemu-devel --Xm/fll+QQv+hsKip Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 12, 2014 at 09:39:16AM +0800, TeLeMan wrote: > On Wed, Jul 9, 2014 at 5:53 PM, Paolo Bonzini 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 > > --- > > 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 >=20 > > @@ -183,6 +318,7 @@ bool aio_poll(AioContext *ctx, bool blocking) > > > > /* wait until next event */ > > while (count > 0) { > > + HANDLE event; > > int ret; > > > > timeout =3D blocking > > @@ -196,13 +332,17 @@ bool aio_poll(AioContext *ctx, bool blocking) > > first =3D false; > > > > /* if we have any signaled events, dispatch event */ > > - if ((DWORD) (ret - WAIT_OBJECT_0) >=3D count) { > > + event =3D NULL; > > + if ((DWORD) (ret - WAIT_OBJECT_0) < count) { > > + event =3D events[ret - WAIT_OBJECT_0]; > > + } else if (!have_select_revents) { >=20 > when (ret - WAIT_OBJECT_0) >=3D 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 --Xm/fll+QQv+hsKip Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUEuxXAAoJEJykq7OBq3PIluwH+wVRbOMwN8TlCUuzpeE7vMiX D5d7un2ZcpEVgFTwHuksbfHsO2DX1zSGIP3Fk0z2r1abvyCLVKYw/9WOoGNVVIIf bGV7S1HmCbaTD3Mlh3WQvhJ1hLuqxv9vWcYuoRZ1jDkfGXqUeqbiDi22IKq2iv39 sl9WQHqx4CKFLDig6D/wYjcbc6VM0G6KiZBbvhib4jERIxgoEcSUSETwuh3VD7Z7 pi2oDgv6WqA1A6nbxzxCHFLlm9xGVYwFXe9v1yjSz/wOOCAzzwWicP0GrUaBIfTY xQDHUmxKnq/GVF28hYFGoBn7rM+PwN2+LqUCmZbFJGiZdLxj8Ejxa9V6pmwhjG0= =oQx5 -----END PGP SIGNATURE----- --Xm/fll+QQv+hsKip--