diff options
author | Matthew Newhook <matthew@zeroc.com> | 2008-03-12 18:50:04 +0800 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2008-03-12 18:50:04 +0800 |
commit | ba5bbb636402043f7dff5cdaa3444b66dd7bffbd (patch) | |
tree | 79ac9e34f32a41945d82826eb4196e859d26a3f9 /cpp/src/IceUtil/RecMutex.cpp | |
parent | Fixed bug with fixVersion.py, and updated the IceStorm service version in tes... (diff) | |
download | ice-ba5bbb636402043f7dff5cdaa3444b66dd7bffbd.tar.bz2 ice-ba5bbb636402043f7dff5cdaa3444b66dd7bffbd.tar.xz ice-ba5bbb636402043f7dff5cdaa3444b66dd7bffbd.zip |
Squashed commit of the following:
I also got rid of some old 0x0400 compatibility stuff in RecMutex and StaticMutex.
commit 8e7277ac6d19922c9be8c4b12a12b909da36eb60
Author: U-MARCH3\matthew <matthew@march3.(none)>
Date: Wed Mar 12 18:19:15 2008 +0800
added missing file.
commit 3ac0a9fdf2c5d976b08d9bbf24b0144e2533c8db
Author: U-MARCH3\matthew <matthew@march3.(none)>
Date: Wed Mar 12 18:12:56 2008 +0800
bug 2752
Diffstat (limited to 'cpp/src/IceUtil/RecMutex.cpp')
-rw-r--r-- | cpp/src/IceUtil/RecMutex.cpp | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp index 7a68dd18d4a..2e185ff99a6 100644 --- a/cpp/src/IceUtil/RecMutex.cpp +++ b/cpp/src/IceUtil/RecMutex.cpp @@ -14,8 +14,6 @@ using namespace std; #ifdef _WIN32 -# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400 - IceUtil::RecMutex::RecMutex() : _count(0) { @@ -76,119 +74,6 @@ IceUtil::RecMutex::lock(LockState& state) const _count = state.count; } -# else - -IceUtil::RecMutex::RecMutex() : - _count(0) -{ - _mutex = CreateMutex(0, false, 0); - if(_mutex == 0) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -} - -IceUtil::RecMutex::~RecMutex() -{ - assert(_count == 0); - BOOL rc = CloseHandle(_mutex); - if(rc == 0) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -} - -void -IceUtil::RecMutex::lock() const -{ - DWORD rc = WaitForSingleObject(_mutex, INFINITE); - if(rc != WAIT_OBJECT_0) - { - if(rc == WAIT_FAILED) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } - else - { - throw ThreadSyscallException(__FILE__, __LINE__, 0); - } - } - - if(++_count > 1) - { - BOOL rc2 = ReleaseMutex(_mutex); - if(rc2 == 0) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } - } -} - -bool -IceUtil::RecMutex::tryLock() const -{ - DWORD rc = WaitForSingleObject(_mutex, 0); - if(rc != WAIT_OBJECT_0) - { - return false; - } - if(++_count > 1) - { - BOOL rc2 = ReleaseMutex(_mutex); - if(rc2 == 0) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } - } - return true; -} - -void -IceUtil::RecMutex::unlock() const -{ - if(--_count == 0) - { - BOOL rc = ReleaseMutex(_mutex); - if(rc == 0) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } - } -} - -void -IceUtil::RecMutex::unlock(LockState& state) const -{ - state.count = _count; - _count = 0; - BOOL rc = ReleaseMutex(_mutex); - if(rc == 0) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -} - -void -IceUtil::RecMutex::lock(LockState& state) const -{ - DWORD rc = WaitForSingleObject(_mutex, INFINITE); - if(rc != WAIT_OBJECT_0) - { - if(rc == WAIT_FAILED) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } - else - { - throw ThreadSyscallException(__FILE__, __LINE__, 0); - } - } - - _count = state.count; -} - -# endif - #else IceUtil::RecMutex::RecMutex() : |