mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-10-04 18:20:06 +00:00
test-thread-pool: use generic AioContext infrastructure
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 <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 20170213135235.12274-5-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
35f106e684
commit
934ebf48c0
|
@ -6,6 +6,7 @@
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
#include "qemu/main-loop.h"
|
||||||
|
|
||||||
static AioContext *ctx;
|
static AioContext *ctx;
|
||||||
static ThreadPool *pool;
|
static ThreadPool *pool;
|
||||||
|
@ -224,15 +225,9 @@ static void test_cancel_async(void)
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
Error *local_error = NULL;
|
|
||||||
|
|
||||||
init_clocks();
|
qemu_init_main_loop(&error_abort);
|
||||||
|
ctx = qemu_get_current_aio_context();
|
||||||
ctx = aio_context_new(&local_error);
|
|
||||||
if (!ctx) {
|
|
||||||
error_reportf_err(local_error, "Failed to create AIO Context: ");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
pool = aio_get_thread_pool(ctx);
|
pool = aio_get_thread_pool(ctx);
|
||||||
|
|
||||||
g_test_init(&argc, &argv, NULL);
|
g_test_init(&argc, &argv, NULL);
|
||||||
|
@ -245,6 +240,5 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
ret = g_test_run();
|
ret = g_test_run();
|
||||||
|
|
||||||
aio_context_unref(ctx);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue