extracted guard locking to a separate class
This commit is contained in:
parent
7db9e585cd
commit
80906c85c6
19
sync/lockable.hpp
Normal file
19
sync/lockable.hpp
Normal 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
|
Loading…
Reference in New Issue
Block a user