qemu-thread: use acquire/release to clarify semantics of QemuEvent
commit374293ca6fb060f0302e5ca76ddccbc2bbb075c9
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 19 Sep 2016 09:10:57 +0000 (19 11:10 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 24 Oct 2016 09:30:55 +0000 (24 11:30 +0200)
treedc95662c0cdcc77ecf1e2f2416756ef05a146f79
parentf1ee86963b9a7bc6a60b823dbf682fd0a62ffcc4
qemu-thread: use acquire/release to clarify semantics of QemuEvent

Do not use the somewhat mysterious atomic_mb_read/atomic_mb_set,
instead make sure that the operations on QemuEvent are annotated
with the desired acquire and release semantics.

In particular, qemu_event_set wakes up the waiting thread, so it must
be a release from the POV of the waker (compare with qemu_mutex_unlock).
And it actually needs a full barrier, because that's the only thing that
provides something like a "load-release".

Use smp_mb_acquire until we have atomic_load_acquire and
atomic_store_release in atomic.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
util/qemu-thread-posix.c
util/qemu-thread-win32.c