diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-10-03 15:11:43 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-10-17 17:31:00 +0200 |
commit | add40e9777de139fb317ca6b1fb0dc142601cfcd (patch) | |
tree | bec5acdd2592edaa95f52afd6ec2526e7f390c49 /include/qemu | |
parent | 0f809e5fbebb36788aea3523be7f93c04f2c7f8c (diff) | |
download | hqemu-add40e9777de139fb317ca6b1fb0dc142601cfcd.zip hqemu-add40e9777de139fb317ca6b1fb0dc142601cfcd.tar.gz |
timer: add timer_mod_anticipate and timer_mod_anticipate_ns
These let a user anticipate the deadline of a timer, atomically with
other sites that call the function. This helps avoiding complicated
lock hierarchies.
Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r-- | include/qemu/timer.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 1254ef7..5afcffc 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -545,6 +545,19 @@ void timer_del(QEMUTimer *ts); void timer_mod_ns(QEMUTimer *ts, int64_t expire_time); /** + * timer_mod_anticipate_ns: + * @ts: the timer + * @expire_time: the expiry time in nanoseconds + * + * Modify a timer to expire at @expire_time or the current time, + * whichever comes earlier. + * + * This function is thread-safe but the timer and its timer list must not be + * freed while this function is running. + */ +void timer_mod_anticipate_ns(QEMUTimer *ts, int64_t expire_time); + +/** * timer_mod: * @ts: the timer * @expire_time: the expire time in the units associated with the timer @@ -558,6 +571,19 @@ void timer_mod_ns(QEMUTimer *ts, int64_t expire_time); void timer_mod(QEMUTimer *ts, int64_t expire_timer); /** + * timer_mod_anticipate: + * @ts: the timer + * @expire_time: the expiry time in nanoseconds + * + * Modify a timer to expire at @expire_time or the current time, whichever + * comes earlier, taking into account the scale associated with the timer. + * + * This function is thread-safe but the timer and its timer list must not be + * freed while this function is running. + */ +void timer_mod_anticipate(QEMUTimer *ts, int64_t expire_time); + +/** * timer_pending: * @ts: the timer * |