]> git.proxmox.com Git - qemu.git/commitdiff
main-loop: add qemu_get_aio_context()
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 7 Mar 2013 12:41:44 +0000 (13:41 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 15 Mar 2013 15:07:50 +0000 (16:07 +0100)
It is very useful to get the main loop AioContext, which is a static
variable in main-loop.c.

I'm not sure whether qemu_get_aio_context() will be necessary in the
future once devices focus on using their own AioContext instead of the
main loop AioContext, but for now it allows us to refactor code to
support multiple AioContext while actually passing the main loop
AioContext.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/main-loop.h
main-loop.c

index 09952885a90d1cf6eced481fc4d9e1314fd4e09c..6f0200a7acca59ea132238a4b15ae943bb375ef5 100644 (file)
@@ -81,6 +81,11 @@ int qemu_init_main_loop(void);
  */
 int main_loop_wait(int nonblocking);
 
+/**
+ * qemu_get_aio_context: Return the main loop's AioContext
+ */
+AioContext *qemu_get_aio_context(void);
+
 /**
  * qemu_notify_event: Force processing of pending events.
  *
index 8c9b58c14c897766313558bd8839d612fb5749c9..eb80ff369f9ef9e327a2170201086702ba9b4db2 100644 (file)
@@ -109,6 +109,11 @@ static int qemu_signal_init(void)
 
 static AioContext *qemu_aio_context;
 
+AioContext *qemu_get_aio_context(void)
+{
+    return qemu_aio_context;
+}
+
 void qemu_notify_event(void)
 {
     if (!qemu_aio_context) {