diff options
Diffstat (limited to 'cpp/test/IceUtil/thread/MonitorMutexTest.cpp')
-rw-r--r-- | cpp/test/IceUtil/thread/MonitorMutexTest.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/cpp/test/IceUtil/thread/MonitorMutexTest.cpp b/cpp/test/IceUtil/thread/MonitorMutexTest.cpp index e9a3df57040..7d04267abef 100644 --- a/cpp/test/IceUtil/thread/MonitorMutexTest.cpp +++ b/cpp/test/IceUtil/thread/MonitorMutexTest.cpp @@ -32,17 +32,13 @@ public: virtual void run() { - try - { - Monitor<Mutex>::TryLock lock(_monitor); - test(false); - } - catch(const ThreadLockedException&) + Monitor<Mutex>::TryLock tlock(_monitor); + test(!tlock.acquired()); + { - // Expected + Mutex::Lock lock(_trylockMutex); + _trylock = true; } - - _trylock = true; _trylockCond.signal(); Monitor<Mutex>::Lock lock(_monitor); @@ -117,16 +113,8 @@ MonitorMutexTest::run() { Monitor<Mutex>::Lock lock(monitor); - // TEST: TryLock - try - { - Monitor<Mutex>::TryLock lock(monitor); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } + Monitor<Mutex>::TryLock tlock(monitor); + test(!tlock.acquired()); // TEST: Start thread, try to acquire the mutex. t = new MonitorMutexTestThread(monitor); |