summaryrefslogtreecommitdiff
path: root/libs/pbd/test/mutex_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/pbd/test/mutex_test.cc')
-rw-r--r--libs/pbd/test/mutex_test.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/pbd/test/mutex_test.cc b/libs/pbd/test/mutex_test.cc
new file mode 100644
index 0000000000..52c36c4695
--- /dev/null
+++ b/libs/pbd/test/mutex_test.cc
@@ -0,0 +1,24 @@
+#include "mutex_test.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION (MutexTest);
+
+using namespace std;
+
+MutexTest::MutexTest ()
+{
+}
+
+void
+MutexTest::testBasic ()
+{
+ Glib::Threads::Mutex::Lock lm (m_mutex);
+
+ CPPUNIT_ASSERT (lm.locked());
+
+ /* This will fail on POSIX systems but not on some older versions of glib
+ * on win32 as TryEnterCriticalSection is used and it will return true
+ * as CriticalSection is reentrant and fail the assertion.
+ */
+ CPPUNIT_ASSERT (!m_mutex.trylock());
+
+}