memgraph/threading/sync/lockable.hpp

20 lines
307 B
C++
Raw Normal View History

#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