]> Git Repo - qemu.git/commitdiff
add assertions on the owner of a QemuMutex
authorPaolo Bonzini <[email protected]>
Sat, 12 Mar 2011 16:43:54 +0000 (17:43 +0100)
committerBlue Swirl <[email protected]>
Sun, 13 Mar 2011 14:44:21 +0000 (14:44 +0000)
These are already present in the Win32 implementation, add them to
the pthread wrappers as well.  Use PTHREAD_MUTEX_ERRORCHECK for mutex
operations. Later we'll add tracking of the owner for cond_signal/broadcast.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
qemu-thread-posix.c

index e3077733fca6f28b59c8e44e26d0ddf7aa4edb60..8b54cc0262d4d7e8c04f2bb4b33c2ad6f9cc8204 100644 (file)
@@ -28,8 +28,12 @@ static void error_exit(int err, const char *msg)
 void qemu_mutex_init(QemuMutex *mutex)
 {
     int err;
+    pthread_mutexattr_t mutexattr;
 
-    err = pthread_mutex_init(&mutex->lock, NULL);
+    pthread_mutexattr_init(&mutexattr);
+    pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK);
+    err = pthread_mutex_init(&mutex->lock, &mutexattr);
+    pthread_mutexattr_destroy(&mutexattr);
     if (err)
         error_exit(err, __func__);
 }
This page took 0.025484 seconds and 4 git commands to generate.