From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDa9b-0007w0-KS for qemu-devel@nongnu.org; Thu, 07 Mar 2013 07:42:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDa9Y-0007Id-O9 for qemu-devel@nongnu.org; Thu, 07 Mar 2013 07:42:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDa9Y-0007IZ-H0 for qemu-devel@nongnu.org; Thu, 07 Mar 2013 07:42:32 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r27CgVXn032578 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 7 Mar 2013 07:42:32 -0500 From: Stefan Hajnoczi Date: Thu, 7 Mar 2013 13:41:44 +0100 Message-Id: <1362660110-26970-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1362660110-26970-1-git-send-email-stefanha@redhat.com> References: <1362660110-26970-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH v2 1/7] main-loop: add qemu_get_aio_context() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Stefan Hajnoczi 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 --- include/qemu/main-loop.h | 5 +++++ main-loop.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index 0995288..6f0200a 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -82,6 +82,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. * * Similar to signaling a condition variable, qemu_notify_event forces diff --git a/main-loop.c b/main-loop.c index 8c9b58c..eb80ff3 100644 --- a/main-loop.c +++ b/main-loop.c @@ -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) { -- 1.8.1.4