diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
commit | abada90e3f84dc703b8ddc9efcbed8a946fadead (patch) | |
tree | 2c6f9dccd510ea97cb927a7bd635422efaae547a /cpp/src/IceUtil/Cond.cpp | |
parent | removing trace message (diff) | |
download | ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2 ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip |
Expanded tabs into spaces
Diffstat (limited to 'cpp/src/IceUtil/Cond.cpp')
-rw-r--r-- | cpp/src/IceUtil/Cond.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/cpp/src/IceUtil/Cond.cpp b/cpp/src/IceUtil/Cond.cpp index ab59e63958e..0f895980c9a 100644 --- a/cpp/src/IceUtil/Cond.cpp +++ b/cpp/src/IceUtil/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()); } } @@ -45,7 +45,7 @@ IceUtil::Semaphore::timedWait(const Time& timeout) const int rc = WaitForSingleObject(_sem, static_cast<long>(timeout.toMilliSeconds())); if(rc != WAIT_TIMEOUT && rc != WAIT_OBJECT_0) { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } return rc != WAIT_TIMEOUT; } @@ -56,7 +56,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()); } } @@ -95,26 +95,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(); } } @@ -134,26 +134,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(); } } @@ -162,13 +162,13 @@ IceUtil::Cond::dowait() const { try { - _queue.wait(); - postWait(false); + _queue.wait(); + postWait(false); } catch(...) { - postWait(false); - throw; + postWait(false); + throw; } } @@ -177,14 +177,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; } } @@ -199,19 +199,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); } } @@ -228,7 +228,7 @@ IceUtil::Cond::signal() int rc = pthread_cond_signal(&_cond); if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } } @@ -238,7 +238,7 @@ IceUtil::Cond::broadcast() int rc = pthread_cond_broadcast(&_cond); if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } } |