mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 06:13:46 +08:00
d0cc2fbfa6
This takes the eventfd emulation code from the main loop. When the EventNotifier is used for the main loop too, we need this compatibility code. Without CONFIG_EVENTFD, event_notifier_get_fd is only usable for the "read" side of the notifier, for example to set a select() handler. The return value of event_notifier_set changes to the cleaner 0/-errno. No caller is actually checking the return value. Reviewed-by: Anthony Liguori <anthony@codemonkey.ws> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
47 lines
994 B
C
47 lines
994 B
C
/*
|
|
* event notifier support
|
|
*
|
|
* Copyright Red Hat, Inc. 2010
|
|
*
|
|
* Authors:
|
|
* Michael S. Tsirkin <mst@redhat.com>
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef QEMU_EVENT_NOTIFIER_H
|
|
#define QEMU_EVENT_NOTIFIER_H
|
|
|
|
#include "qemu-common.h"
|
|
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
struct EventNotifier {
|
|
#ifdef _WIN32
|
|
HANDLE event;
|
|
#else
|
|
int rfd;
|
|
int wfd;
|
|
#endif
|
|
};
|
|
|
|
typedef void EventNotifierHandler(EventNotifier *);
|
|
|
|
int event_notifier_init(EventNotifier *, int active);
|
|
void event_notifier_cleanup(EventNotifier *);
|
|
int event_notifier_set(EventNotifier *);
|
|
int event_notifier_test_and_clear(EventNotifier *);
|
|
int event_notifier_set_handler(EventNotifier *, EventNotifierHandler *);
|
|
|
|
#ifdef CONFIG_POSIX
|
|
void event_notifier_init_fd(EventNotifier *, int fd);
|
|
int event_notifier_get_fd(EventNotifier *);
|
|
#else
|
|
HANDLE event_notifier_get_handle(EventNotifier *);
|
|
#endif
|
|
|
|
#endif
|