From: bellard Date: Sun, 6 Aug 2006 09:51:25 +0000 (+0000) Subject: fixed blocking io emulation X-Git-Tag: release_0_9_1~1805 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=85ad0ed875362f0edf2bf2838555d33dafe75312;p=qemu-xen-3.3-testing.git fixed blocking io emulation --- diff --git a/block-raw.c b/block-raw.c index 14f4bd5b..adb3d39a 100644 --- a/block-raw.c +++ b/block-raw.c @@ -308,6 +308,11 @@ void qemu_aio_wait(void) { sigset_t set; int nb_sigs; + +#ifndef QEMU_TOOL + if (qemu_bh_poll()) + return; +#endif sigemptyset(&set); sigaddset(&set, aio_sig_num); sigwait(&set, &nb_sigs); diff --git a/vl.c b/vl.c index 6daed966..0504c6f1 100644 --- a/vl.c +++ b/vl.c @@ -5200,19 +5200,23 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque) return bh; } -void qemu_bh_poll(void) +int qemu_bh_poll(void) { QEMUBH *bh, **pbh; + int ret; + ret = 0; for(;;) { pbh = &first_bh; bh = *pbh; if (!bh) break; + ret = 1; *pbh = bh->next; bh->scheduled = 0; bh->cb(bh->opaque); } + return ret; } void qemu_bh_schedule(QEMUBH *bh) diff --git a/vl.h b/vl.h index f7174246..ce52fb82 100644 --- a/vl.h +++ b/vl.h @@ -495,7 +495,7 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque); void qemu_bh_schedule(QEMUBH *bh); void qemu_bh_cancel(QEMUBH *bh); void qemu_bh_delete(QEMUBH *bh); -void qemu_bh_poll(void); +int qemu_bh_poll(void); /* block.c */ typedef struct BlockDriverState BlockDriverState;