From 6b5f876252b7aeec43e319afdf17705f512be2bc Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 20 Feb 2013 11:28:32 +0100 Subject: aio: convert aio_poll() to g_poll(3) AioHandler already has a GPollFD so we can directly use its events/revents. Add the int pollfds_idx field to AioContext so we can map g_poll(3) results back to AioHandlers. Reuse aio_dispatch() to invoke handlers after g_poll(3). Signed-off-by: Stefan Hajnoczi Reviewed-by: Laszlo Ersek Message-id: 1361356113-11049-10-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori --- async.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'async.c') diff --git a/async.c b/async.c index 72d268ae35..f2d47ba96d 100644 --- a/async.c +++ b/async.c @@ -174,6 +174,7 @@ aio_ctx_finalize(GSource *source) aio_set_event_notifier(ctx, &ctx->notifier, NULL, NULL); event_notifier_cleanup(&ctx->notifier); + g_array_free(ctx->pollfds, TRUE); } static GSourceFuncs aio_source_funcs = { @@ -198,6 +199,7 @@ AioContext *aio_context_new(void) { AioContext *ctx; ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext)); + ctx->pollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD)); event_notifier_init(&ctx->notifier, false); aio_set_event_notifier(ctx, &ctx->notifier, (EventNotifierHandler *) -- cgit v1.2.1