summary refs log tree commit diff stats
path: root/main-loop.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2015-09-07 11:28:58 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2015-09-07 18:14:03 +0200
commitf3926945c85689e8af324c0db0b39be771dbbebb (patch)
tree886a0e84aa50d6e34191f4366c2a589b0680f4fa /main-loop.c
parent46036b2462c7ff56c0af6466ea6b9248197a38a8 (diff)
downloadfocaccia-qemu-f3926945c85689e8af324c0db0b39be771dbbebb.tar.gz
focaccia-qemu-f3926945c85689e8af324c0db0b39be771dbbebb.zip
iohandler: Use aio API
iohandler.c shares the same interface with aio, but with duplicated
code. It's better to rebase iohandler, also because that aio is a
more friendly interface to multi-threads.

Create a global AioContext instance and let its GSource handle the
iohandler events.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <1441596538-4412-1-git-send-email-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'main-loop.c')
-rw-r--r--main-loop.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/main-loop.c b/main-loop.c
index 39970437f8..db600a37f1 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -161,6 +161,9 @@ int qemu_init_main_loop(Error **errp)
     src = aio_get_g_source(qemu_aio_context);
     g_source_attach(src, NULL);
     g_source_unref(src);
+    src = iohandler_get_g_source();
+    g_source_attach(src, NULL);
+    g_source_unref(src);
     return 0;
 }
 
@@ -487,7 +490,6 @@ int main_loop_wait(int nonblocking)
 #ifdef CONFIG_SLIRP
     slirp_pollfds_fill(gpollfds, &timeout);
 #endif
-    qemu_iohandler_fill(gpollfds);
 
     if (timeout == UINT32_MAX) {
         timeout_ns = -1;
@@ -500,7 +502,6 @@ int main_loop_wait(int nonblocking)
                                           &main_loop_tlg));
 
     ret = os_host_main_loop_wait(timeout_ns);
-    qemu_iohandler_poll(gpollfds, ret);
 #ifdef CONFIG_SLIRP
     slirp_pollfds_poll(gpollfds, (ret < 0));
 #endif