qemu/include/qemu/event_notifier.h
<<
>>
Prefs
   1/*
   2 * event notifier support
   3 *
   4 * Copyright Red Hat, Inc. 2010
   5 *
   6 * Authors:
   7 *  Michael S. Tsirkin <mst@redhat.com>
   8 *
   9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
  10 * See the COPYING file in the top-level directory.
  11 */
  12
  13#ifndef QEMU_EVENT_NOTIFIER_H
  14#define QEMU_EVENT_NOTIFIER_H
  15
  16#include "qemu-common.h"
  17
  18#ifdef _WIN32
  19#include <windows.h>
  20#endif
  21
  22struct EventNotifier {
  23#ifdef _WIN32
  24    HANDLE event;
  25#else
  26    int rfd;
  27    int wfd;
  28#endif
  29};
  30
  31typedef void EventNotifierHandler(EventNotifier *);
  32
  33int event_notifier_init(EventNotifier *, int active);
  34void event_notifier_cleanup(EventNotifier *);
  35int event_notifier_set(EventNotifier *);
  36int event_notifier_test_and_clear(EventNotifier *);
  37int event_notifier_set_handler(EventNotifier *,
  38                               bool is_external,
  39                               EventNotifierHandler *);
  40
  41#ifdef CONFIG_POSIX
  42void event_notifier_init_fd(EventNotifier *, int fd);
  43int event_notifier_get_fd(const EventNotifier *);
  44#else
  45HANDLE event_notifier_get_handle(EventNotifier *);
  46#endif
  47
  48#endif
  49