qemu

Форк
0
/
event_notifier-win32.c 
49 строк · 961.0 Байт
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
#include "qemu/osdep.h"
14
#include "qemu/event_notifier.h"
15
#include "qemu/main-loop.h"
16

17
int event_notifier_init(EventNotifier *e, int active)
18
{
19
    e->event = CreateEvent(NULL, TRUE, FALSE, NULL);
20
    assert(e->event);
21
    return 0;
22
}
23

24
void event_notifier_cleanup(EventNotifier *e)
25
{
26
    CloseHandle(e->event);
27
    e->event = NULL;
28
}
29

30
HANDLE event_notifier_get_handle(EventNotifier *e)
31
{
32
    return e->event;
33
}
34

35
int event_notifier_set(EventNotifier *e)
36
{
37
    SetEvent(e->event);
38
    return 0;
39
}
40

41
int 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
}
50

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.