Fix lock store bug.
Summary: Lock store was not locking properly. It created a lock object which was destructed in the end of function scope which caused bits to be set to UNLOCKED. Reviewers: matej.gradicek, buda Reviewed By: matej.gradicek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D154
This commit is contained in:
parent
6be2399ad1
commit
f505c76189
@ -39,11 +39,11 @@ class LockStore {
|
|||||||
public:
|
public:
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
void take(T *lock, Args &&... args) {
|
void take(T *lock, Args &&... args) {
|
||||||
auto holder = LockHolder(lock, std::forward<Args>(args)...);
|
|
||||||
|
|
||||||
if (!holder.active()) return;
|
|
||||||
|
|
||||||
locks.emplace_back(LockHolder(lock, std::forward<Args>(args)...));
|
locks.emplace_back(LockHolder(lock, std::forward<Args>(args)...));
|
||||||
|
if (!locks.back().active()) {
|
||||||
|
locks.pop_back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user