mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 01:07:57 +00:00
Cleanup.
This commit is contained in:
10
ScopedLock.h
10
ScopedLock.h
@@ -6,15 +6,15 @@
|
|||||||
// This is a returnable lock holder.
|
// This is a returnable lock holder.
|
||||||
// I don't know why Boost doesn't provide a good way to do this.
|
// I don't know why Boost doesn't provide a good way to do this.
|
||||||
|
|
||||||
class ScopedLock
|
class ScopedLock
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
boost::mutex *mMutex; // parent object has greater scope, so guaranteed valid
|
boost::mutex *mMutex; // parent object has greater scope, so guaranteed valid
|
||||||
mutable bool mValid;
|
mutable bool mValid;
|
||||||
|
|
||||||
ScopedLock(); // no implementation
|
ScopedLock(); // no implementation
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScopedLock(boost::mutex &mutex) : mMutex(&mutex), mValid(true)
|
ScopedLock(boost::mutex &mutex) : mMutex(&mutex), mValid(true)
|
||||||
{
|
{
|
||||||
mMutex->lock();
|
mMutex->lock();
|
||||||
@@ -46,6 +46,6 @@
|
|||||||
sl.mValid=false;
|
sl.mValid=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user