mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Move sources to src and build objs in obj.
This commit is contained in:
27
src/ScopedLock.h
Normal file
27
src/ScopedLock.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef __SCOPEDLOCKHOLDER__
|
||||
#define __SCOPEDLOCKHOLDER__
|
||||
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
class ScopedLock
|
||||
{
|
||||
protected:
|
||||
mutable boost::shared_ptr<boost::interprocess::scoped_lock<boost::recursive_mutex> > mHolder;
|
||||
|
||||
public:
|
||||
ScopedLock(boost::recursive_mutex &mutex) :
|
||||
mHolder(new boost::interprocess::scoped_lock<boost::recursive_mutex>(mutex))
|
||||
{ ; }
|
||||
void lock() const
|
||||
{
|
||||
mHolder->lock();
|
||||
}
|
||||
void unlock() const
|
||||
{
|
||||
mHolder->unlock();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user