mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
aio: add I/O handlers to the AioContext interface
With this patch, I/O handlers (including event notifier handlers) can be attached to a single AioContext. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f627aab1cc
commit
a915f4bc97
4 changed files with 101 additions and 48 deletions
33
main-loop.c
33
main-loop.c
|
@ -526,3 +526,36 @@ int qemu_bh_poll(void)
|
|||
{
|
||||
return aio_bh_poll(qemu_aio_context);
|
||||
}
|
||||
|
||||
void qemu_aio_flush(void)
|
||||
{
|
||||
aio_flush(qemu_aio_context);
|
||||
}
|
||||
|
||||
bool qemu_aio_wait(void)
|
||||
{
|
||||
return aio_wait(qemu_aio_context);
|
||||
}
|
||||
|
||||
void qemu_aio_set_fd_handler(int fd,
|
||||
IOHandler *io_read,
|
||||
IOHandler *io_write,
|
||||
AioFlushHandler *io_flush,
|
||||
void *opaque)
|
||||
{
|
||||
aio_set_fd_handler(qemu_aio_context, fd, io_read, io_write, io_flush,
|
||||
opaque);
|
||||
|
||||
qemu_set_fd_handler2(fd, NULL, io_read, io_write, opaque);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_POSIX
|
||||
void qemu_aio_set_event_notifier(EventNotifier *notifier,
|
||||
EventNotifierHandler *io_read,
|
||||
AioFlushEventNotifierHandler *io_flush)
|
||||
{
|
||||
qemu_aio_set_fd_handler(event_notifier_get_fd(notifier),
|
||||
(IOHandler *)io_read, NULL,
|
||||
(AioFlushHandler *)io_flush, notifier);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue