Permalink
Browse files

main-loop: add qemu_get_aio_context()

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>
  • Loading branch information...
1 parent ed9ba72 commit 5f3aa1ff4781f39e05b9892d58319a09fedc8918 Stefan Hajnoczi committed Mar 7, 2013
Showing with 10 additions and 0 deletions.
  1. +5 −0 include/qemu/main-loop.h
  2. +5 −0 main-loop.c
View
@@ -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.
*
View
@@ -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) {

0 comments on commit 5f3aa1f

Please sign in to comment.