mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 14:24:35 +01:00
trunk/branch integration: SharedPtr to AtomicCounter
This commit is contained in:
parent
f215fb195a
commit
6cebba23c3
@ -1,7 +1,7 @@
|
||||
//
|
||||
// SharedPtr.h
|
||||
//
|
||||
// $Id: //poco/1.3/Foundation/include/Poco/SharedPtr.h#6 $
|
||||
// $Id: //poco/1.4/Foundation/include/Poco/SharedPtr.h#1 $
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Core
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/AtomicCounter.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@ -59,24 +59,21 @@ public:
|
||||
|
||||
void duplicate()
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
++_cnt;
|
||||
}
|
||||
|
||||
int release()
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
return --_cnt;
|
||||
}
|
||||
|
||||
int referenceCount() const
|
||||
{
|
||||
return _cnt;
|
||||
return _cnt.value();
|
||||
}
|
||||
|
||||
private:
|
||||
FastMutex _mutex;
|
||||
int _cnt;
|
||||
AtomicCounter _cnt;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user