]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added code for triggering QMutex::tryLock(int).
authorBart Van Assche <bvanassche@acm.org>
Mon, 7 Jul 2008 18:35:55 +0000 (18:35 +0000)
committerBart Van Assche <bvanassche@acm.org>
Mon, 7 Jul 2008 18:35:55 +0000 (18:35 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8385

drd/tests/qt4_mutex.cpp

index 314e08432c6297bf6a09960addba360fb648ec82..36ee5cc4e306f8eb23a848b902a8da325797e3c4 100644 (file)
@@ -4,8 +4,9 @@
 #define _GNU_SOURCE
 #endif
 
-#include <QtCore/QThread> // class QThread
 #include <QtCore/QMutex>  // class QMutex
+#include <QtCore/QThread> // class QThread
+#include <cassert>
 #include <cstdio>         // fprintf()
 #include <cstdlib>        // atoi()
 #include <new>
@@ -51,8 +52,14 @@ int main(int argc, char** argv)
     // Stack-allocated mutex.
     QMutex M(QMutex::Recursive);
     M.lock();
-    M.tryLock();
+    assert(M.tryLock());
+    M.unlock();
     M.unlock();
+  }
+  {
+    QMutex M(QMutex::NonRecursive);
+    assert(M.tryLock(1));
+    assert(! M.tryLock(1));
     M.unlock();
   }