aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorDietmar Maurer <dietmar@proxmox.com>2019-10-24 06:56:10 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2019-10-25 14:38:29 +0200
commitd154ef37ff885918fa3e512fd7a8e42870291667 (patch)
tree2bb43f26fd2b921527c4bcba4e554c0b6a8a613b /util
parent7bfde688fb1b05fa5f73d2498be959e59e1e1d57 (diff)
downloadqemu-d154ef37ff885918fa3e512fd7a8e42870291667.zip
qemu-d154ef37ff885918fa3e512fd7a8e42870291667.tar.gz
qemu-d154ef37ff885918fa3e512fd7a8e42870291667.tar.bz2
yield_until_fd_readable: make it work with any AioContect
Simply use qemu_get_current_aio_context(). Signed-off-by: Dietmar Maurer <dietmar@proxmox.com> Message-Id: <20191024045610.9071-1-dietmar@proxmox.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-coroutine-io.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/util/qemu-coroutine-io.c b/util/qemu-coroutine-io.c
index 44a8969..5b80bb4 100644
--- a/util/qemu-coroutine-io.c
+++ b/util/qemu-coroutine-io.c
@@ -67,6 +67,7 @@ qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send)
}
typedef struct {
+ AioContext *ctx;
Coroutine *co;
int fd;
} FDYieldUntilData;
@@ -74,7 +75,7 @@ typedef struct {
static void fd_coroutine_enter(void *opaque)
{
FDYieldUntilData *data = opaque;
- qemu_set_fd_handler(data->fd, NULL, NULL, NULL);
+ aio_set_fd_handler(data->ctx, data->fd, false, NULL, NULL, NULL, NULL);
qemu_coroutine_enter(data->co);
}
@@ -83,8 +84,10 @@ void coroutine_fn yield_until_fd_readable(int fd)
FDYieldUntilData data;
assert(qemu_in_coroutine());
+ data.ctx = qemu_get_current_aio_context();
data.co = qemu_coroutine_self();
data.fd = fd;
- qemu_set_fd_handler(fd, fd_coroutine_enter, NULL, &data);
+ aio_set_fd_handler(
+ data.ctx, fd, false, fd_coroutine_enter, NULL, NULL, &data);
qemu_coroutine_yield();
}