diff options
author | Michi Henning <michi@zeroc.com> | 2009-12-09 15:12:12 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2009-12-09 15:12:12 +1000 |
commit | d0d27bb7cf7b5ff8f9f3028f63f650f1d0b01678 (patch) | |
tree | 9524523d712bca42f6bd36fabd72c76371ecdca8 /cpp/src/Ice/GC.cpp | |
parent | Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff) | |
parent | fix for cpp/test/Ice/Makefile.mak (diff) | |
download | ice-d0d27bb7cf7b5ff8f9f3028f63f650f1d0b01678.tar.bz2 ice-d0d27bb7cf7b5ff8f9f3028f63f650f1d0b01678.tar.xz ice-d0d27bb7cf7b5ff8f9f3028f63f650f1d0b01678.zip |
Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice
Diffstat (limited to 'cpp/src/Ice/GC.cpp')
-rw-r--r-- | cpp/src/Ice/GC.cpp | 56 |
1 files changed, 14 insertions, 42 deletions
diff --git a/cpp/src/Ice/GC.cpp b/cpp/src/Ice/GC.cpp index 40372534131..83b282c9473 100644 --- a/cpp/src/Ice/GC.cpp +++ b/cpp/src/Ice/GC.cpp @@ -78,52 +78,11 @@ using namespace IceInternal; // // GCShared // - void IceInternal::GCShared::__incRef() { IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); assert(_ref >= 0); - ++_ref; -} - -void -IceInternal::GCShared::__decRef() -{ - IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); - bool doDelete = false; - assert(_ref > 0); - if(--_ref == 0) - { - doDelete = !_noDelete; - _noDelete = true; - } - lock.release(); - if(doDelete) - { - delete this; - } -} - -int -IceInternal::GCShared::__getRef() const -{ - IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); - return _ref; -} - -void -IceInternal::GCShared::__setNoDelete(bool b) -{ - IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); - _noDelete = b; -} - -void -IceInternal::GCShared::__gcIncRef() -{ - IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); - assert(_ref >= 0); if(_ref == 0 && gcObjects != 0) { #ifdef NDEBUG // To avoid annoying warnings about variables that are not used... @@ -137,7 +96,7 @@ IceInternal::GCShared::__gcIncRef() } void -IceInternal::GCShared::__gcDecRef() +IceInternal::GCShared::__decRef() { IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); bool doDelete = false; @@ -160,6 +119,19 @@ IceInternal::GCShared::__gcDecRef() } } +int +IceInternal::GCShared::__getRef() const +{ + IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); + return _ref; +} + +void +IceInternal::GCShared::__setNoDelete(bool b) +{ + IceUtilInternal::MutexPtrLock<IceUtil::RecMutex> lock(gcRecMutex); + _noDelete = b; +} // // GC |