mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 14:02:05 -06:00
qemu-io: use main_loop_wait
This will let timers run during aio_read and aio_write commands, though not during synchronous commands. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
3ed9902528
commit
a5a5238ee4
2 changed files with 9 additions and 8 deletions
10
cmd.c
10
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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue