]> git.proxmox.com Git - mirror_qemu.git/blobdiff - tests/test-thread-pool.c
e1000: disable debug by default
[mirror_qemu.git] / tests / test-thread-pool.c
index ed2b25b8eb39f660f6f6c67327b2b9b14ad8bd16..91b4ec552490b0fcca9336d2ed4d766c8d48dffe 100644 (file)
@@ -1,16 +1,19 @@
-#include <glib.h>
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "block/aio.h"
 #include "block/thread-pool.h"
 #include "block/block.h"
+#include "qapi/error.h"
 #include "qemu/timer.h"
+#include "qemu/error-report.h"
+#include "qemu/main-loop.h"
 
 static AioContext *ctx;
 static ThreadPool *pool;
 static int active;
 
 typedef struct {
-    BlockDriverAIOCB *aiocb;
+    BlockAIOCB *aiocb;
     int n;
     int ret;
 } WorkerTestData;
@@ -89,9 +92,9 @@ static void co_test_cb(void *opaque)
 static void test_submit_co(void)
 {
     WorkerTestData data;
-    Coroutine *co = qemu_coroutine_create(co_test_cb);
+    Coroutine *co = qemu_coroutine_create(co_test_cb, &data);
 
-    qemu_coroutine_enter(co, &data);
+    qemu_coroutine_enter(co);
 
     /* Back here once the worker has started.  */
 
@@ -223,9 +226,8 @@ int main(int argc, char **argv)
 {
     int ret;
 
-    init_clocks();
-
-    ctx = aio_context_new();
+    qemu_init_main_loop(&error_abort);
+    ctx = qemu_get_current_aio_context();
     pool = aio_get_thread_pool(ctx);
 
     g_test_init(&argc, &argv, NULL);
@@ -238,6 +240,5 @@ int main(int argc, char **argv)
 
     ret = g_test_run();
 
-    aio_context_unref(ctx);
     return ret;
 }