mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-22 01:21:53 -06:00
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>
This commit is contained in:
parent
025bdeab3c
commit
c096358e74
4 changed files with 69 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue