mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-23 13:32:11 +01:00
trunk/branch integration: RefCountedObject to AtomicCounter
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
RefCountedObject::RefCountedObject(): _rc(1)
|
RefCountedObject::RefCountedObject(): _counter(1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,21 +50,4 @@ RefCountedObject::~RefCountedObject()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RefCountedObject::duplicate() const
|
|
||||||
{
|
|
||||||
_rcMutex.lock();
|
|
||||||
++_rc;
|
|
||||||
_rcMutex.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RefCountedObject::release() const
|
|
||||||
{
|
|
||||||
_rcMutex.lock();
|
|
||||||
int rc = --_rc;
|
|
||||||
_rcMutex.unlock();
|
|
||||||
if (rc == 0) delete this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
|||||||
Reference in New Issue
Block a user