aboutsummaryrefslogtreecommitdiff
path: root/src/reverselock.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/reverselock.h')
-rw-r--r--src/reverselock.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/reverselock.h b/src/reverselock.h
index 567636e16a..fac1ccb793 100644
--- a/src/reverselock.h
+++ b/src/reverselock.h
@@ -15,10 +15,12 @@ public:
explicit reverse_lock(Lock& lock) : lock(lock) {
lock.unlock();
+ lock.swap(templock);
}
~reverse_lock() {
- lock.lock();
+ templock.lock();
+ templock.swap(lock);
}
private:
@@ -26,6 +28,7 @@ private:
reverse_lock& operator=(reverse_lock const&);
Lock& lock;
+ Lock templock;
};
#endif // BITCOIN_REVERSELOCK_H