diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2007-08-24 11:28:20 -0400 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2007-08-24 11:28:20 -0400 |
commit | 9a07052d6711858507faa27ff736d4520b3163e9 (patch) | |
tree | 7fa0a0406be0386a8314b2e8c742f29bf127b70d /cpp/include | |
parent | Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff) | |
parent | Squashed commit of the following: (diff) | |
download | ice-9a07052d6711858507faa27ff736d4520b3163e9.tar.bz2 ice-9a07052d6711858507faa27ff736d4520b3163e9.tar.xz ice-9a07052d6711858507faa27ff736d4520b3163e9.zip |
Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice
Diffstat (limited to 'cpp/include')
-rw-r--r-- | cpp/include/IceUtil/Handle.h | 16 | ||||
-rw-r--r-- | cpp/include/IceUtil/Shared.h | 55 |
2 files changed, 12 insertions, 59 deletions
diff --git a/cpp/include/IceUtil/Handle.h b/cpp/include/IceUtil/Handle.h index df233134548..683afe62869 100644 --- a/cpp/include/IceUtil/Handle.h +++ b/cpp/include/IceUtil/Handle.h @@ -98,10 +98,10 @@ inline bool operator==(const HandleBase<T>& lhs, const HandleBase<U>& rhs) { return *l == *r; } - else - { - return !l && !r; - } + + // Note: don't use if { } else { }. This causes lots warnings when + // compiling with GCC and optimization enabled. See bug 2330. + return !l && !r; } template<typename T, typename U> @@ -119,10 +119,10 @@ inline bool operator<(const HandleBase<T>& lhs, const HandleBase<U>& rhs) { return *l < *r; } - else - { - return !l && r; - } + + // Note: don't use if { } else { }. This causes lots warnings when + // compiling with GCC and optimization enabled. See bug 2330. + return !l && r; } template<typename T, typename U> diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index c80b6b35c5b..61b466d9895 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -197,57 +197,10 @@ public: return *this; } - void __incRef() - { -#if defined(_WIN32) - assert(InterlockedExchangeAdd(&_ref, 0) >= 0); - InterlockedIncrement(&_ref); -#elif defined(ICE_HAS_ATOMIC_FUNCTIONS) - assert(ice_atomic_exchange_add(0, &_ref) >= 0); - ice_atomic_inc(&_ref); -#else - _mutex.lock(); - assert(_ref >= 0); - ++_ref; - _mutex.unlock(); -#endif - } - - void __decRef() - { -#if defined(_WIN32) - assert(InterlockedExchangeAdd(&_ref, 0) > 0); - if(InterlockedDecrement(&_ref) == 0 && !_noDelete) - { - _noDelete = true; - delete this; - } -#elif defined(ICE_HAS_ATOMIC_FUNCTIONS) - assert(ice_atomic_exchange_add(0, &_ref) > 0); - if(ice_atomic_dec_and_test(&_ref) && !_noDelete) - { - _noDelete = true; - delete this; - } -#else - _mutex.lock(); - bool doDelete = false; - assert(_ref > 0); - if(--_ref == 0) - { - doDelete = !_noDelete; - _noDelete = true; - } - _mutex.unlock(); - if(doDelete) - { - delete this; - } -#endif - } - - int __getRef() const; - void __setNoDelete(bool); + virtual void __incRef(); + virtual void __decRef(); + virtual int __getRef() const; + virtual void __setNoDelete(bool); protected: |