From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S79tM-0005r2-My for qemu-devel@nongnu.org; Mon, 12 Mar 2012 14:22:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S79tE-0001hR-JE for qemu-devel@nongnu.org; Mon, 12 Mar 2012 14:22:44 -0400 Received: from mail-ey0-f173.google.com ([209.85.215.173]:55236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S79tE-0001hA-Au for qemu-devel@nongnu.org; Mon, 12 Mar 2012 14:22:36 -0400 Received: by eaaf11 with SMTP id f11so1620819eaa.4 for ; Mon, 12 Mar 2012 11:22:34 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 12 Mar 2012 19:22:22 +0100 Message-Id: <1331576548-23067-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1331576548-23067-1-git-send-email-pbonzini@redhat.com> References: <1331576548-23067-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 1/7] qemu-io: use main_loop_wait List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This will let timers run during aio_read and aio_write commands, though not during synchronous commands. Signed-off-by: Paolo Bonzini --- cmd.c | 10 +++++----- qemu-io.c | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd.c b/cmd.c index 0806e18..7ffbb71 100644 --- a/cmd.c +++ b/cmd.c @@ -25,6 +25,7 @@ #include "cmd.h" #include "qemu-aio.h" +#include "main-loop.h" #define _(x) x /* not gettext support yet */ @@ -146,7 +147,7 @@ static void prep_fetchline(void *opaque) { int *fetchable = opaque; - qemu_aio_set_fd_handler(STDIN_FILENO, NULL, NULL, NULL, NULL, NULL); + qemu_set_fd_handler(STDIN_FILENO, NULL, NULL, NULL); *fetchable= 1; } @@ -193,12 +194,11 @@ void command_loop(void) if (!prompted) { printf("%s", get_prompt()); fflush(stdout); - qemu_aio_set_fd_handler(STDIN_FILENO, prep_fetchline, NULL, NULL, - NULL, &fetchable); + qemu_set_fd_handler(STDIN_FILENO, prep_fetchline, NULL, &fetchable); prompted = 1; } - qemu_aio_wait(); + main_loop_wait(false); if (!fetchable) { continue; @@ -221,7 +221,7 @@ void command_loop(void) prompted = 0; fetchable = 0; } - qemu_aio_set_fd_handler(STDIN_FILENO, NULL, NULL, NULL, NULL, NULL); + qemu_set_fd_handler(STDIN_FILENO, NULL, NULL, NULL); } /* from libxcmd/input.c */ diff --git a/qemu-io.c b/qemu-io.c index 3189530..e9b7369 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -15,6 +15,7 @@ #include #include "qemu-common.h" +#include "main-loop.h" #include "block_int.h" #include "cmd.h" @@ -294,7 +295,7 @@ static int do_aio_readv(QEMUIOVector *qiov, int64_t offset, int *total) bdrv_aio_readv(bs, offset >> 9, qiov, qiov->size >> 9, aio_rw_done, &async_ret); while (async_ret == NOT_DONE) { - qemu_aio_wait(); + main_loop_wait(false); } *total = qiov->size; @@ -308,7 +309,7 @@ static int do_aio_writev(QEMUIOVector *qiov, int64_t offset, int *total) bdrv_aio_writev(bs, offset >> 9, qiov, qiov->size >> 9, aio_rw_done, &async_ret); while (async_ret == NOT_DONE) { - qemu_aio_wait(); + main_loop_wait(false); } *total = qiov->size; @@ -351,7 +352,7 @@ static int do_aio_multiwrite(BlockRequest* reqs, int num_reqs, int *total) } while (async_ret.num_done < num_reqs) { - qemu_aio_wait(); + main_loop_wait(false); } return async_ret.error < 0 ? async_ret.error : 1; -- 1.7.7.6