summaryrefslogtreecommitdiff
path: root/cpp/include/IceUtil/Shared.h
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-08-24 11:28:20 -0400
committerDwayne Boone <dwayne@zeroc.com>2007-08-24 11:28:20 -0400
commit9a07052d6711858507faa27ff736d4520b3163e9 (patch)
tree7fa0a0406be0386a8314b2e8c742f29bf127b70d /cpp/include/IceUtil/Shared.h
parentMerge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff)
parentSquashed commit of the following: (diff)
downloadice-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/IceUtil/Shared.h')
-rw-r--r--cpp/include/IceUtil/Shared.h55
1 files changed, 4 insertions, 51 deletions
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: