mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-23 10:01:59 -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
|
@ -5,11 +5,13 @@
|
|||
|
||||
struct QemuMutex {
|
||||
SRWLOCK lock;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
typedef struct QemuRecMutex QemuRecMutex;
|
||||
struct QemuRecMutex {
|
||||
CRITICAL_SECTION lock;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
void qemu_rec_mutex_destroy(QemuRecMutex *mutex);
|
||||
|
@ -19,15 +21,18 @@ void qemu_rec_mutex_unlock(QemuRecMutex *mutex);
|
|||
|
||||
struct QemuCond {
|
||||
CONDITION_VARIABLE var;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
struct QemuSemaphore {
|
||||
HANDLE sema;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
struct QemuEvent {
|
||||
int value;
|
||||
HANDLE event;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
typedef struct QemuThreadData QemuThreadData;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue