diff options
author | Bernard Normier <bernard@zeroc.com> | 2004-04-19 21:44:50 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2004-04-19 21:44:50 +0000 |
commit | c4fce53b0a51b4b6df57758a01f213129716a94c (patch) | |
tree | 984bbd3e845efe7c60261d940e12e3e542a99f4f | |
parent | Added keep, keepFacet, remove and removeFacet to Evictor; bug fixes (diff) | |
download | ice-c4fce53b0a51b4b6df57758a01f213129716a94c.tar.bz2 ice-c4fce53b0a51b4b6df57758a01f213129716a94c.tar.xz ice-c4fce53b0a51b4b6df57758a01f213129716a94c.zip |
Windows build fixes
-rw-r--r-- | cpp/include/IceUtil/Cache.h | 4 | ||||
-rw-r--r-- | cpp/include/IceUtil/CountDownLatch.h | 3 | ||||
-rw-r--r-- | cpp/src/IceUtil/CountDownLatch.cpp | 6 |
3 files changed, 6 insertions, 7 deletions
diff --git a/cpp/include/IceUtil/Cache.h b/cpp/include/IceUtil/Cache.h index ff2f4cbbe72..9f0d3b917ee 100644 --- a/cpp/include/IceUtil/Cache.h +++ b/cpp/include/IceUtil/Cache.h @@ -50,7 +50,7 @@ public: struct CacheValue { - CacheValue(const Handle<Value>& o = 0) : + CacheValue(const Handle<Value>& o) : obj(o), latch(0) { @@ -199,7 +199,7 @@ Cache<Key, Value>::pinImpl(const Key& key, const Handle<Value>& newObj) #else std::pair<typename CacheMap::iterator, bool> ir = #endif - _map.insert(CacheMap::value_type(key, CacheValue())); + _map.insert(CacheMap::value_type(key, CacheValue(0))); if(ir.second == false) { diff --git a/cpp/include/IceUtil/CountDownLatch.h b/cpp/include/IceUtil/CountDownLatch.h index ddd4fd18568..78f2b119552 100644 --- a/cpp/include/IceUtil/CountDownLatch.h +++ b/cpp/include/IceUtil/CountDownLatch.h @@ -32,11 +32,12 @@ public: int getCount() const; private: - int _count; #ifdef _WIN32 + mutable LONG _count; HANDLE _event; #else + int _count; mutable pthread_mutex_t _mutex; mutable pthread_cond_t _cond; diff --git a/cpp/src/IceUtil/CountDownLatch.cpp b/cpp/src/IceUtil/CountDownLatch.cpp index 6e1f37d8646..41a9d60abe6 100644 --- a/cpp/src/IceUtil/CountDownLatch.cpp +++ b/cpp/src/IceUtil/CountDownLatch.cpp @@ -49,8 +49,7 @@ void IceUtil::CountDownLatch::await() const { #ifdef _WIN32 - int* countPtr = const_cast<int*>(&_count); - while(InterlockedCompareExchange(countPtr, 0, 0) > 0) + while(InterlockedExchangeAdd(&_count, 0) > 0) { DWORD rc = WaitForSingleObject(_event, INFINITE); assert(rc == WAIT_OBJECT_0 || rc == WAIT_FAILED); @@ -113,8 +112,7 @@ int IceUtil::CountDownLatch::getCount() const { #ifdef _WIN32 - int* countPtr = const_cast<int*>(&_count); - int count = InterlockedCompareExchange(countPtr, 0, 0); + int count = InterlockedExchangeAdd(&_count, 0); return count > 0 ? count : 0; #else lock(); |