Make qemu_shutdown_requested signal-safe
commit817ef04db2cfa2df04daffd6917f4ea7605f6403
authorJan Kiszka <jan.kiszka@siemens.com>
Mon, 27 Oct 2014 14:05:10 +0000 (27 14:05 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 27 Oct 2014 14:09:27 +0000 (27 14:09 +0000)
tree2c4d84c6cdda963f4aa929766311487b8649cee3
parentff0d48768bd51717b05e77014221b66543953731
Make qemu_shutdown_requested signal-safe

qemu_shutdown_requested may be interrupted by qemu_system_killed. If the
latter sets shutdown_requested after qemu_shutdown_requested has read it
but before it was cleared, the shutdown event is lost. Fix this by using
atomic_xchg.

This provides a different fix for the problem which commit 15124e142
attempts to deal with. That commit breaks use of ^C to drop into gdb,
and so this approach is better (and 15124e142 can be reverted).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
[PMM: commit message tweak]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
vl.c