Commit 6eb5733a3cad93b00043d48fa22b9df7d1f5ab33
1 parent
15e6690a
fixed blocking io emulation
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2090 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
11 additions
and
2 deletions
block-raw.c
| @@ -308,6 +308,11 @@ void qemu_aio_wait(void) | @@ -308,6 +308,11 @@ void qemu_aio_wait(void) | ||
| 308 | { | 308 | { |
| 309 | sigset_t set; | 309 | sigset_t set; |
| 310 | int nb_sigs; | 310 | int nb_sigs; |
| 311 | + | ||
| 312 | +#ifndef QEMU_TOOL | ||
| 313 | + if (qemu_bh_poll()) | ||
| 314 | + return; | ||
| 315 | +#endif | ||
| 311 | sigemptyset(&set); | 316 | sigemptyset(&set); |
| 312 | sigaddset(&set, aio_sig_num); | 317 | sigaddset(&set, aio_sig_num); |
| 313 | sigwait(&set, &nb_sigs); | 318 | sigwait(&set, &nb_sigs); |
vl.c
| @@ -5200,19 +5200,23 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque) | @@ -5200,19 +5200,23 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque) | ||
| 5200 | return bh; | 5200 | return bh; |
| 5201 | } | 5201 | } |
| 5202 | 5202 | ||
| 5203 | -void qemu_bh_poll(void) | 5203 | +int qemu_bh_poll(void) |
| 5204 | { | 5204 | { |
| 5205 | QEMUBH *bh, **pbh; | 5205 | QEMUBH *bh, **pbh; |
| 5206 | + int ret; | ||
| 5206 | 5207 | ||
| 5208 | + ret = 0; | ||
| 5207 | for(;;) { | 5209 | for(;;) { |
| 5208 | pbh = &first_bh; | 5210 | pbh = &first_bh; |
| 5209 | bh = *pbh; | 5211 | bh = *pbh; |
| 5210 | if (!bh) | 5212 | if (!bh) |
| 5211 | break; | 5213 | break; |
| 5214 | + ret = 1; | ||
| 5212 | *pbh = bh->next; | 5215 | *pbh = bh->next; |
| 5213 | bh->scheduled = 0; | 5216 | bh->scheduled = 0; |
| 5214 | bh->cb(bh->opaque); | 5217 | bh->cb(bh->opaque); |
| 5215 | } | 5218 | } |
| 5219 | + return ret; | ||
| 5216 | } | 5220 | } |
| 5217 | 5221 | ||
| 5218 | void qemu_bh_schedule(QEMUBH *bh) | 5222 | void qemu_bh_schedule(QEMUBH *bh) |
vl.h
| @@ -495,7 +495,7 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque); | @@ -495,7 +495,7 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque); | ||
| 495 | void qemu_bh_schedule(QEMUBH *bh); | 495 | void qemu_bh_schedule(QEMUBH *bh); |
| 496 | void qemu_bh_cancel(QEMUBH *bh); | 496 | void qemu_bh_cancel(QEMUBH *bh); |
| 497 | void qemu_bh_delete(QEMUBH *bh); | 497 | void qemu_bh_delete(QEMUBH *bh); |
| 498 | -void qemu_bh_poll(void); | 498 | +int qemu_bh_poll(void); |
| 499 | 499 | ||
| 500 | /* block.c */ | 500 | /* block.c */ |
| 501 | typedef struct BlockDriverState BlockDriverState; | 501 | typedef struct BlockDriverState BlockDriverState; |