aboutsummaryrefslogtreecommitdiff
path: root/util/qemu-timer.c
diff options
context:
space:
mode:
authorArtem Pisarenko <artem.k.pisarenko@gmail.com>2018-10-17 14:24:19 +0600
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-19 13:44:03 +0200
commit89a603a0c80ae3d6a8711571550b2ae9a01ea909 (patch)
tree1d6cc3a535a2f02c1bf249ade3a0368bbdb0dc55 /util/qemu-timer.c
parent05ff8dc32fa124e7bbf77a257f863f3685c7be9d (diff)
qemu-timer: introduce timer attributes
Attributes are simple flags, associated with individual timers for their whole lifetime. They intended to be used to mark individual timers for special handling when they fire. New/init functions family in timer interface updated and refactored (new 'attribute' argument added, timer_list replaced with timer_list_group+type combinations, comments improved to avoid info duplication). Also existing aio interface extended with attribute-enabled variants of functions, which create/initialize timers. Signed-off-by: Artem Pisarenko <artem.k.pisarenko@gmail.com> Message-Id: <f47b81dbce734e9806f9516eba8ca588e6321c2f.1539764043.git.artem.k.pisarenko@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/qemu-timer.c')
-rw-r--r--util/qemu-timer.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index 86bfe84037..04527a343f 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -339,14 +339,19 @@ int qemu_poll_ns(GPollFD *fds, guint nfds, int64_t timeout)
}
-void timer_init_tl(QEMUTimer *ts,
- QEMUTimerList *timer_list, int scale,
- QEMUTimerCB *cb, void *opaque)
+void timer_init_full(QEMUTimer *ts,
+ QEMUTimerListGroup *timer_list_group, QEMUClockType type,
+ int scale, int attributes,
+ QEMUTimerCB *cb, void *opaque)
{
- ts->timer_list = timer_list;
+ if (!timer_list_group) {
+ timer_list_group = &main_loop_tlg;
+ }
+ ts->timer_list = timer_list_group->tl[type];
ts->cb = cb;
ts->opaque = opaque;
ts->scale = scale;
+ ts->attributes = attributes;
ts->expire_time = -1;
}