Il 30/07/2013 11:51, Alex Bligh ha scritto: > As far as walking the QEMUTimerList itself is concerned, this is > something which is 99.999% done by the thread owning the AioContext. > qemu_clock_enable should not even be walking this list. So I don't > see why the protection here is needed.
The protection is needed not because of qemu_clock_enable, but rather because of code in qemu_clock_enable's caller. Such code likely expects not to run concurrently with timers. qemu_clock_enable however can be called from other threads than the one owning the AioContext. Furthermore, it can happen while timer callbacks are being called, because callbacks are called without holding any lock. If you put together these conditions, qemu_clock_enable has to wait for timer callbacks to finish running before returning. Paolo