Statistics
| Branch: | Revision:

root / notify.c @ a74cdab4

History | View | Annotate | Download (814 Bytes)

1 d1e70c5e Anthony Liguori
/*
2 d1e70c5e Anthony Liguori
 * Notifier lists
3 d1e70c5e Anthony Liguori
 *
4 d1e70c5e Anthony Liguori
 * Copyright IBM, Corp. 2010
5 d1e70c5e Anthony Liguori
 *
6 d1e70c5e Anthony Liguori
 * Authors:
7 d1e70c5e Anthony Liguori
 *  Anthony Liguori   <aliguori@us.ibm.com>
8 d1e70c5e Anthony Liguori
 *
9 d1e70c5e Anthony Liguori
 * This work is licensed under the terms of the GNU GPL, version 2.  See
10 d1e70c5e Anthony Liguori
 * the COPYING file in the top-level directory.
11 d1e70c5e Anthony Liguori
 *
12 d1e70c5e Anthony Liguori
 */
13 d1e70c5e Anthony Liguori
14 d1e70c5e Anthony Liguori
#include "qemu-common.h"
15 d1e70c5e Anthony Liguori
#include "notify.h"
16 d1e70c5e Anthony Liguori
17 d1e70c5e Anthony Liguori
void notifier_list_init(NotifierList *list)
18 d1e70c5e Anthony Liguori
{
19 d1e70c5e Anthony Liguori
    QTAILQ_INIT(&list->notifiers);
20 d1e70c5e Anthony Liguori
}
21 d1e70c5e Anthony Liguori
22 d1e70c5e Anthony Liguori
void notifier_list_add(NotifierList *list, Notifier *notifier)
23 d1e70c5e Anthony Liguori
{
24 d1e70c5e Anthony Liguori
    QTAILQ_INSERT_HEAD(&list->notifiers, notifier, node);
25 d1e70c5e Anthony Liguori
}
26 d1e70c5e Anthony Liguori
27 d1e70c5e Anthony Liguori
void notifier_list_remove(NotifierList *list, Notifier *notifier)
28 d1e70c5e Anthony Liguori
{
29 d1e70c5e Anthony Liguori
    QTAILQ_REMOVE(&list->notifiers, notifier, node);
30 d1e70c5e Anthony Liguori
}
31 d1e70c5e Anthony Liguori
32 d1e70c5e Anthony Liguori
void notifier_list_notify(NotifierList *list)
33 d1e70c5e Anthony Liguori
{
34 d1e70c5e Anthony Liguori
    Notifier *notifier, *next;
35 d1e70c5e Anthony Liguori
36 d1e70c5e Anthony Liguori
    QTAILQ_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
37 d1e70c5e Anthony Liguori
        notifier->notify(notifier);
38 d1e70c5e Anthony Liguori
    }
39 d1e70c5e Anthony Liguori
}