summaryrefslogtreecommitdiff
path: root/cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp')
-rw-r--r--cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp b/cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp
index e8996fdac8c..7c64106a215 100644
--- a/cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp
+++ b/cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp
@@ -32,17 +32,14 @@ public:
virtual void run()
{
- try
- {
- Monitor<RecMutex>::TryLock lock(_monitor);
- test(false);
- }
- catch(const ThreadLockedException&)
+
+ Monitor<RecMutex>::TryLock tlock(_monitor);
+ test(!tlock.acquired());
+
{
- // Expected
+ Mutex::Lock lock(_trylockMutex);
+ _trylock = true;
}
-
- _trylock = true;
_trylockCond.signal();
Monitor<RecMutex>::Lock lock(_monitor);
@@ -119,16 +116,12 @@ MonitorRecMutexTest::run()
Monitor<RecMutex>::Lock lock(monitor);
Monitor<RecMutex>::TryLock lock2(monitor);
+ test(lock2.acquired());
// TEST: TryLock
- try
- {
- Monitor<RecMutex>::TryLock lock(monitor);
- }
- catch(const ThreadLockedException&)
- {
- test(false);
- }
+
+ Monitor<RecMutex>::TryLock tlock(monitor);
+ test(tlock.acquired());
// TEST: Start thread, try to acquire the mutex.
t = new MonitorRecMutexTestThread(monitor);