mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
refactor: move ScopedLockBool from header to cpp file
This commit is contained in:
parent
7aafb5a393
commit
1570a02c89
@ -33,6 +33,25 @@ const std::string GovernanceStore::SERIALIZATION_VERSION_STRING = "CGovernanceMa
|
||||
const int CGovernanceManager::MAX_TIME_FUTURE_DEVIATION = 60 * 60;
|
||||
const int CGovernanceManager::RELIABLE_PROPAGATION_TIME = 60;
|
||||
|
||||
namespace {
|
||||
class ScopedLockBool
|
||||
{
|
||||
bool& ref;
|
||||
bool fPrevValue;
|
||||
|
||||
public:
|
||||
ScopedLockBool(RecursiveMutex& _cs, bool& _ref, bool _value) :
|
||||
ref(_ref)
|
||||
{
|
||||
AssertLockHeld(_cs);
|
||||
fPrevValue = ref;
|
||||
ref = _value;
|
||||
}
|
||||
|
||||
~ScopedLockBool() { ref = fPrevValue; }
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
GovernanceStore::GovernanceStore() :
|
||||
cs(),
|
||||
mapObjects(),
|
||||
|
@ -231,26 +231,6 @@ private:
|
||||
using hash_s_t = std::set<uint256>;
|
||||
using db_type = CFlatDB<GovernanceStore>;
|
||||
|
||||
class ScopedLockBool
|
||||
{
|
||||
bool& ref;
|
||||
bool fPrevValue;
|
||||
|
||||
public:
|
||||
ScopedLockBool(RecursiveMutex& _cs, bool& _ref, bool _value) :
|
||||
ref(_ref)
|
||||
{
|
||||
AssertLockHeld(_cs);
|
||||
fPrevValue = ref;
|
||||
ref = _value;
|
||||
}
|
||||
|
||||
~ScopedLockBool()
|
||||
{
|
||||
ref = fPrevValue;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
static const int MAX_TIME_FUTURE_DEVIATION;
|
||||
static const int RELIABLE_PROPAGATION_TIME;
|
||||
|
Loading…
Reference in New Issue
Block a user