diff options
author | Mark Spruiell <mes@zeroc.com> | 2008-06-03 19:32:20 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2008-06-03 19:32:20 -0700 |
commit | 3d649bed4328992f41f567136025f58a019a5159 (patch) | |
tree | 470be901fbbfe5c6cd4269884412b0d36b48dc92 /cppe/test/IceE/thread/StaticMutexTest.cpp | |
parent | local interface fixes for slice2javae (diff) | |
download | ice-3d649bed4328992f41f567136025f58a019a5159.tar.bz2 ice-3d649bed4328992f41f567136025f58a019a5159.tar.xz ice-3d649bed4328992f41f567136025f58a019a5159.zip |
Various Ice-E fixes:
- Bug fix in slice2javae for local interfaces/classes
- Added Ice.LocalObjectHolder
- Reviewed Java/C++ demos and aligned with Ice
- Source code clean up (removed tabs, etc.)
Diffstat (limited to 'cppe/test/IceE/thread/StaticMutexTest.cpp')
-rw-r--r-- | cppe/test/IceE/thread/StaticMutexTest.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/cppe/test/IceE/thread/StaticMutexTest.cpp b/cppe/test/IceE/thread/StaticMutexTest.cpp index f7c40712bc7..e1133d04dde 100644 --- a/cppe/test/IceE/thread/StaticMutexTest.cpp +++ b/cppe/test/IceE/thread/StaticMutexTest.cpp @@ -25,32 +25,32 @@ class StaticMutexTestThread : public Thread public: StaticMutexTestThread() : - _tryLock(false) + _tryLock(false) { } virtual void run() - { - StaticMutex::TryLock tlock(staticMutex); - test(!tlock.acquired()); + { + StaticMutex::TryLock tlock(staticMutex); + test(!tlock.acquired()); - { - Mutex::Lock lock(_tryLockMutex); - _tryLock = true; - } - _tryLockCond.signal(); + { + Mutex::Lock lock(_tryLockMutex); + _tryLock = true; + } + _tryLockCond.signal(); - StaticMutex::Lock lock(staticMutex); + StaticMutex::Lock lock(staticMutex); } void waitTryLock() { - Mutex::Lock lock(_tryLockMutex); - while(!_tryLock) - { - _tryLockCond.wait(lock); - } + Mutex::Lock lock(_tryLockMutex); + while(!_tryLock) + { + _tryLockCond.wait(lock); + } } private: @@ -77,70 +77,70 @@ StaticMutexTest::run() ThreadControl control; { - StaticMutex::Lock lock(staticMutex); - - // LockT testing: - // - - test(lock.acquired()); - - try - { - lock.acquire(); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } - - try - { - lock.tryAcquire(); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } - - test(lock.acquired()); - lock.release(); - test(!lock.acquired()); - - try - { - lock.release(); - test(false); - } - catch(const ThreadLockedException&) - { - // Expected - } - - StaticMutex::TryLock lock2(staticMutex); - // - // Under WinCE tryAcquire() does not do recursion checks. - // + StaticMutex::Lock lock(staticMutex); + + // LockT testing: + // + + test(lock.acquired()); + + try + { + lock.acquire(); + test(false); + } + catch(const ThreadLockedException&) + { + // Expected + } + + try + { + lock.tryAcquire(); + test(false); + } + catch(const ThreadLockedException&) + { + // Expected + } + + test(lock.acquired()); + lock.release(); + test(!lock.acquired()); + + try + { + lock.release(); + test(false); + } + catch(const ThreadLockedException&) + { + // Expected + } + + StaticMutex::TryLock lock2(staticMutex); + // + // Under WinCE tryAcquire() does not do recursion checks. + // #ifndef _WIN32_WCE - try - { - test(lock.tryAcquire() == false); - } - catch(const IceUtil::ThreadLockedException&) - { - } - lock2.release(); - test(lock.tryAcquire() == true); - test(lock.acquired()); + try + { + test(lock.tryAcquire() == false); + } + catch(const IceUtil::ThreadLockedException&) + { + } + lock2.release(); + test(lock.tryAcquire() == true); + test(lock.acquired()); #endif - // TEST: Start thread, try to acquire the mutex. - t = new StaticMutexTestThread; - control = t->start(); - - // TEST: Wait until the tryLock has been tested. - t->waitTryLock(); + // TEST: Start thread, try to acquire the mutex. + t = new StaticMutexTestThread; + control = t->start(); + + // TEST: Wait until the tryLock has been tested. + t->waitTryLock(); } // |