On 05/05/2017 12:38, Alex Bennée wrote: > > while (qemu_tcg_should_sleep(cpu)) { > + qemu_mutex_lock_iothread(); > stop_tcg_kick_timer(); > qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); > + qemu_mutex_unlock_iothread(); > }
This is racy. You need to recheck the condition under the lock, or to switch from QemuCond to QemuEvent (then you still need to check the condition twice, the second between qemu_event_reset and qemu_event_wait). Paolo