2 * event notifier support
4 * Copyright Red Hat, Inc. 2010
7 * Michael S. Tsirkin <mst@redhat.com>
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.
13 #include "qemu/osdep.h"
14 #include "qemu-common.h"
15 #include "qemu/event_notifier.h"
16 #include "qemu/main-loop.h"
18 int event_notifier_init(EventNotifier
*e
, int active
)
20 e
->event
= CreateEvent(NULL
, TRUE
, FALSE
, NULL
);
25 void event_notifier_cleanup(EventNotifier
*e
)
27 CloseHandle(e
->event
);
31 HANDLE
event_notifier_get_handle(EventNotifier
*e
)
36 int event_notifier_set(EventNotifier
*e
)
42 int event_notifier_test_and_clear(EventNotifier
*e
)
44 int ret
= WaitForSingleObject(e
->event
, 0);
45 if (ret
== WAIT_OBJECT_0
) {