summaryrefslogtreecommitdiff
path: root/cpp/include/IceUtil/Shared.h
diff options
context:
space:
mode:
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: