aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLiu Ping Fan <qemulist@gmail.com>2013-09-25 14:21:00 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2013-10-17 17:30:56 +0200
commit3c05341157f4d08dc3cc8ffa675a0aaa4818d028 (patch)
treee85bbd366560bb67a778b60acabd904ca2004d94 /include
parentc7c4d063f50f0de980d99f02e055722227d703bc (diff)
timer: make qemu_clock_enable sync between disable and timer's cb
After disabling the QemuClock, we should make sure that no QemuTimers are still in flight. To implement that with light overhead, we resort to QemuEvent. The caller of disabling will wait on QemuEvent of each timerlist. Note, qemu_clock_enable(foo,false) can _not_ be called from timer's cb. Also, the callers of qemu_clock_enable() should be protected by the BQL. Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/timer.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 016e29ae95..1254ef729e 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -189,6 +189,12 @@ void qemu_clock_notify(QEMUClockType type);
* @enabled: true to enable, false to disable
*
* Enable or disable a clock
+ * Disabling the clock will wait for related timerlists to stop
+ * executing qemu_run_timers. Thus, this functions should not
+ * be used from the callback of a timer that is based on @clock.
+ * Doing so would cause a deadlock.
+ *
+ * Caller should hold BQL.
*/
void qemu_clock_enable(QEMUClockType type, bool enabled);