]> git.proxmox.com Git - mirror_qemu.git/blame - util/event_notifier-win32.c
slirp: Send RDNSS in RA only if host has an IPv6 DNS server
[mirror_qemu.git] / util / event_notifier-win32.c
CommitLineData
fc97a652
PB
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
aafd7584 13#include "qemu/osdep.h"
fc97a652 14#include "qemu-common.h"
1de7afc9
PB
15#include "qemu/event_notifier.h"
16#include "qemu/main-loop.h"
fc97a652
PB
17
18int event_notifier_init(EventNotifier *e, int active)
19{
e9bff10f 20 e->event = CreateEvent(NULL, TRUE, FALSE, NULL);
fc97a652
PB
21 assert(e->event);
22 return 0;
23}
24
25void event_notifier_cleanup(EventNotifier *e)
26{
27 CloseHandle(e->event);
28}
29
30HANDLE event_notifier_get_handle(EventNotifier *e)
31{
32 return e->event;
33}
34
fc97a652
PB
35int event_notifier_set(EventNotifier *e)
36{
37 SetEvent(e->event);
38 return 0;
39}
40
41int event_notifier_test_and_clear(EventNotifier *e)
42{
43 int ret = WaitForSingleObject(e->event, 0);
44 if (ret == WAIT_OBJECT_0) {
45 ResetEvent(e->event);
46 return true;
47 }
48 return false;
49}