diff options
author | Fam Zheng <famz@redhat.com> | 2017-07-04 20:23:25 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-07-04 14:39:28 +0200 |
commit | c096358e747e88fc7364e40e3c354ee0bb683960 (patch) | |
tree | 241c11c021450913505a090cf2cf5629c1488a41 /include/qemu/thread-posix.h | |
parent | 025bdeab3c163aee9604a60b2332a5fcbcc00f8d (diff) | |
download | qemu-c096358e747e88fc7364e40e3c354ee0bb683960.zip qemu-c096358e747e88fc7364e40e3c354ee0bb683960.tar.gz qemu-c096358e747e88fc7364e40e3c354ee0bb683960.tar.bz2 |
qemu-thread: Assert locks are initialized before using
Not all platforms check whether a lock is initialized before used. In
particular Linux seems to be more permissive than OSX.
Check initialization state explicitly in our code to catch such bugs
earlier.
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170704122325.25634-1-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu/thread-posix.h')
-rw-r--r-- | include/qemu/thread-posix.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index 09d1e15..e5e3a0f 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -12,10 +12,12 @@ typedef QemuMutex QemuRecMutex; struct QemuMutex { pthread_mutex_t lock; + bool initialized; }; struct QemuCond { pthread_cond_t cond; + bool initialized; }; struct QemuSemaphore { @@ -26,6 +28,7 @@ struct QemuSemaphore { #else sem_t sem; #endif + bool initialized; }; struct QemuEvent { @@ -34,6 +37,7 @@ struct QemuEvent { pthread_cond_t cond; #endif unsigned value; + bool initialized; }; struct QemuThread { |