[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/24] test-thread-pool: use generic AioContext infra
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 04/24] test-thread-pool: use generic AioContext infrastructure |
Date: |
Mon, 20 Feb 2017 09:32:44 +0000 |
From: Paolo Bonzini <address@hidden>
Once the thread pool starts using aio_co_wake, it will also need
qemu_get_current_aio_context(). Make test-thread-pool create
an AioContext with qemu_init_main_loop, so that stubs/iothread.c
and tests/iothread.c can provide the rest.
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
tests/test-thread-pool.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c
index 8dbf66a..91b4ec5 100644
--- a/tests/test-thread-pool.c
+++ b/tests/test-thread-pool.c
@@ -6,6 +6,7 @@
#include "qapi/error.h"
#include "qemu/timer.h"
#include "qemu/error-report.h"
+#include "qemu/main-loop.h"
static AioContext *ctx;
static ThreadPool *pool;
@@ -224,15 +225,9 @@ static void test_cancel_async(void)
int main(int argc, char **argv)
{
int ret;
- Error *local_error = NULL;
- init_clocks();
-
- ctx = aio_context_new(&local_error);
- if (!ctx) {
- error_reportf_err(local_error, "Failed to create AIO Context: ");
- exit(1);
- }
+ qemu_init_main_loop(&error_abort);
+ ctx = qemu_get_current_aio_context();
pool = aio_get_thread_pool(ctx);
g_test_init(&argc, &argv, NULL);
@@ -245,6 +240,5 @@ int main(int argc, char **argv)
ret = g_test_run();
- aio_context_unref(ctx);
return ret;
}
--
2.9.3
- [Qemu-devel] [PULL 00/24] Block patches, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 03/24] block-backend: allow blk_prw from coroutine context, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 01/24] block: move AioContext, QEMUTimer, main-loop to libqemuutil, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 02/24] aio: introduce aio_co_schedule and aio_co_wake, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 04/24] test-thread-pool: use generic AioContext infrastructure,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 05/24] io: add methods to set I/O handlers on AioContext, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 08/24] coroutine-lock: reschedule coroutine on the AioContext it was running on, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 06/24] io: make qio_channel_yield aware of AioContexts, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 07/24] nbd: convert to use qio_channel_yield, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 09/24] blkdebug: reschedule coroutine on the AioContext it is running on, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 10/24] qed: introduce qed_aio_start_io and qed_aio_next_io_cb, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 11/24] aio: push aio_context_acquire/release down to dispatching, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 12/24] block: explicitly acquire aiocontext in timers that need it, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 13/24] block: explicitly acquire aiocontext in callbacks that need it, Stefan Hajnoczi, 2017/02/20
- [Qemu-devel] [PULL 14/24] block: explicitly acquire aiocontext in bottom halves that need it, Stefan Hajnoczi, 2017/02/20