extracted guard locking to a separate class

This commit is contained in:
Dominik Tomičević 2015-07-31 12:33:49 +02:00
parent 7db9e585cd
commit 80906c85c6

19
sync/lockable.hpp Normal file
View File

@ -0,0 +1,19 @@
#ifndef MEMGRAPH_SYNC_LOCKABLE_HPP
#define MEMGRAPH_SYNC_LOCKABLE_HPP
#include <mutex>
#include "spinlock.hpp"
template <class lock_t = SpinLock>
class Lockable
{
protected:
std::unique_lock<lock_t> acquire()
{
return std::unique_lock<lock_t>(lock);
}
lock_t lock;
};
#endif