static void main_loop(void)
{
- bool nonblocking;
- int last_io = 0;
-
quit = false;
do {
- nonblocking = last_io > 0;
- last_io = main_loop_wait(nonblocking);
+ main_loop_wait(false);
} while (!quit);
}
FeHandler *h = opaque;
h->last_event = event;
- quit = true;
+ if (event != CHR_EVENT_BREAK) {
+ quit = true;
+ }
}
#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS
file.in = fifo;
file.has_in = true;
- chr = qemu_chardev_new(NULL, TYPE_CHARDEV_FILE, &backend,
+ chr = qemu_chardev_new("label-file", TYPE_CHARDEV_FILE, &backend,
&error_abort);
qemu_chr_fe_init(&be, chr, &error_abort);
fe_event,
&fe, NULL, true);
+ g_assert_cmpint(fe.last_event, !=, CHR_EVENT_BREAK);
+ qmp_chardev_send_break("label-foo", NULL);
+ g_assert_cmpint(fe.last_event, !=, CHR_EVENT_BREAK);
+ qmp_chardev_send_break("label-file", NULL);
+ g_assert_cmpint(fe.last_event, ==, CHR_EVENT_BREAK);
+
main_loop();
close(fd);