]> git.proxmox.com Git - mirror_qemu.git/commit - util/qemu-timer.c
qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 12 Sep 2013 09:02:19 +0000 (11:02 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 18 Sep 2013 13:48:33 +0000 (15:48 +0200)
commit978f2205c791de0e02c8802a645bea657408abfd
tree891dad80378641797daa324f4bce9fb2a709fb79
parentda718ceb1730bfe6fea0178df979639b14a0646e
qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

Introduce QEMUTimerList->active_timers_lock to protect the linked list
of active timers.  This allows qemu_timer_mod_ns() to be called from any
thread.

Note that vm_clock is not thread-safe and its use of
qemu_clock_has_timers() works fine today but is also not thread-safe.

The purpose of this patch is to eventually let device models set or
cancel timers from a vcpu thread without holding the global mutex.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
include/qemu/timer.h
qemu-timer.c