}
typedef struct {
+ AioContext *ctx;
Coroutine *co;
int fd;
} FDYieldUntilData;
static void fd_coroutine_enter(void *opaque)
{
FDYieldUntilData *data = opaque;
- qemu_set_fd_handler(data->fd, NULL, NULL, NULL);
- qemu_coroutine_enter(data->co, NULL);
+ aio_set_fd_handler(data->ctx, data->fd, false, NULL, NULL, NULL, NULL);
+ qemu_coroutine_enter(data->co);
}
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();
}