diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-09-24 14:57:41 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-30 09:30:53 +0100 |
commit | e3713e001fb7d4d82f6de82800c1463e758e4289 (patch) | |
tree | 6fda705e8c592e257d260fd37c6cbbac77d21f5a /aio-posix.c | |
parent | f42b22077bc63a482d7a8755b54e33475ab78541 (diff) | |
download | qemu-e3713e001fb7d4d82f6de82800c1463e758e4289.zip qemu-e3713e001fb7d4d82f6de82800c1463e758e4289.tar.gz qemu-e3713e001fb7d4d82f6de82800c1463e758e4289.tar.bz2 |
aio: make AioContexts GSources
This lets AioContexts be used (optionally) with a glib main loop.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'aio-posix.c')
-rw-r--r-- | aio-posix.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/aio-posix.c b/aio-posix.c index 4424722..65b2607 100644 --- a/aio-posix.c +++ b/aio-posix.c @@ -56,6 +56,8 @@ void aio_set_fd_handler(AioContext *ctx, /* Are we deleting the fd handler? */ if (!io_read && !io_write) { if (node) { + g_source_remove_poll(&ctx->source, &node->pfd); + /* If the lock is held, just mark the node as deleted */ if (ctx->walking_handlers) { node->deleted = 1; @@ -75,6 +77,8 @@ void aio_set_fd_handler(AioContext *ctx, node = g_malloc0(sizeof(AioHandler)); node->pfd.fd = fd; QLIST_INSERT_HEAD(&ctx->aio_handlers, node, node); + + g_source_add_poll(&ctx->source, &node->pfd); } /* Update handler with latest information */ node->io_read = io_read; |