Commit 6eb5733a3cad93b00043d48fa22b9df7d1f5ab33

Authored by bellard
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 308 {
309 309 sigset_t set;
310 310 int nb_sigs;
  311 +
  312 +#ifndef QEMU_TOOL
  313 + if (qemu_bh_poll())
  314 + return;
  315 +#endif
311 316 sigemptyset(&set);
312 317 sigaddset(&set, aio_sig_num);
313 318 sigwait(&set, &nb_sigs);
... ...
... ... @@ -5200,19 +5200,23 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
5200 5200 return bh;
5201 5201 }
5202 5202  
5203   -void qemu_bh_poll(void)
  5203 +int qemu_bh_poll(void)
5204 5204 {
5205 5205 QEMUBH *bh, **pbh;
  5206 + int ret;
5206 5207  
  5208 + ret = 0;
5207 5209 for(;;) {
5208 5210 pbh = &first_bh;
5209 5211 bh = *pbh;
5210 5212 if (!bh)
5211 5213 break;
  5214 + ret = 1;
5212 5215 *pbh = bh->next;
5213 5216 bh->scheduled = 0;
5214 5217 bh->cb(bh->opaque);
5215 5218 }
  5219 + return ret;
5216 5220 }
5217 5221  
5218 5222 void qemu_bh_schedule(QEMUBH *bh)
... ...
... ... @@ -495,7 +495,7 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
495 495 void qemu_bh_schedule(QEMUBH *bh);
496 496 void qemu_bh_cancel(QEMUBH *bh);
497 497 void qemu_bh_delete(QEMUBH *bh);
498   -void qemu_bh_poll(void);
  498 +int qemu_bh_poll(void);
499 499  
500 500 /* block.c */
501 501 typedef struct BlockDriverState BlockDriverState;
... ...