diff options
Diffstat (limited to 'cppe/src/IceE/Cond.cpp')
-rw-r--r-- | cppe/src/IceE/Cond.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/cppe/src/IceE/Cond.cpp b/cppe/src/IceE/Cond.cpp index a761cb9f894..760cdd612d8 100644 --- a/cppe/src/IceE/Cond.cpp +++ b/cppe/src/IceE/Cond.cpp @@ -20,7 +20,7 @@ IceUtil::Semaphore::Semaphore(long initial) _sem = CreateSemaphore(0, initial, 0x7fffffff, 0); if(_sem == INVALID_HANDLE_VALUE) { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } @@ -35,7 +35,7 @@ IceUtil::Semaphore::wait() const int rc = WaitForSingleObject(_sem, INFINITE); if(rc != WAIT_OBJECT_0) { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } @@ -47,7 +47,7 @@ IceUtil::Semaphore::timedWait(const Time& timeout) const int rc = WaitForSingleObject(_sem, msec); if(rc != WAIT_TIMEOUT && rc != WAIT_OBJECT_0) { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } return rc != WAIT_TIMEOUT; } @@ -58,7 +58,7 @@ IceUtil::Semaphore::post(int count) const int rc = ReleaseSemaphore(_sem, count, 0); if(rc == 0) { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } @@ -97,26 +97,26 @@ IceUtil::Cond::wake(bool broadcast) if(_unblocked != 0) { - _blocked -= _unblocked; - _unblocked = 0; + _blocked -= _unblocked; + _unblocked = 0; } if(_blocked > 0) { - // - // Unblock some number of waiters. - // - _toUnblock = (broadcast) ? _blocked : 1; - _internal.unlock(); - _queue.post(); + // + // Unblock some number of waiters. + // + _toUnblock = (broadcast) ? _blocked : 1; + _internal.unlock(); + _queue.post(); } else { - // - // Otherwise no blocked waiters, release gate & mutex. - // - _gate.post(); - _internal.unlock(); + // + // Otherwise no blocked waiters, release gate & mutex. + // + _gate.post(); + _internal.unlock(); } } @@ -136,26 +136,26 @@ IceUtil::Cond::postWait(bool timedOut) const if(_toUnblock != 0) { - bool last = --_toUnblock == 0; - _internal.unlock(); - - if(timedOut) - { - _queue.wait(); - } - - if(last) - { - _gate.post(); - } - else - { - _queue.post(); - } + bool last = --_toUnblock == 0; + _internal.unlock(); + + if(timedOut) + { + _queue.wait(); + } + + if(last) + { + _gate.post(); + } + else + { + _queue.post(); + } } else { - _internal.unlock(); + _internal.unlock(); } } @@ -164,13 +164,13 @@ IceUtil::Cond::dowait() const { try { - _queue.wait(); - postWait(false); + _queue.wait(); + postWait(false); } catch(...) { - postWait(false); - throw; + postWait(false); + throw; } } @@ -179,14 +179,14 @@ IceUtil::Cond::timedDowait(const Time& timeout) const { try { - bool rc = _queue.timedWait(timeout); - postWait(!rc); - return rc; + bool rc = _queue.timedWait(timeout); + postWait(!rc); + return rc; } catch(...) { - postWait(false); - throw; + postWait(false); + throw; } } @@ -201,19 +201,19 @@ IceUtil::Cond::Cond() rc = pthread_condattr_init(&attr); if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } rc = pthread_cond_init(&_cond, &attr); if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } rc = pthread_condattr_destroy(&attr); if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } } @@ -230,7 +230,7 @@ IceUtil::Cond::signal() int rc = pthread_cond_signal(&_cond); if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } } @@ -240,7 +240,7 @@ IceUtil::Cond::broadcast() int rc = pthread_cond_broadcast(&_cond); if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } } |