Raven Core  3.0.0
P2P Digital Currency
reverselock.h
Go to the documentation of this file.
1 // Copyright (c) 2015-2016 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_REVERSELOCK_H
7 #define RAVEN_REVERSELOCK_H
8 
12 template<typename Lock>
14 {
15 public:
16 
17  explicit reverse_lock(Lock& _lock) : lock(_lock) {
18  _lock.unlock();
19  _lock.swap(templock);
20  }
21 
23  templock.lock();
24  templock.swap(lock);
25  }
26 
27 private:
28  reverse_lock(reverse_lock const&);
30 
31  Lock& lock;
32  Lock templock;
33 };
34 
35 #endif // RAVEN_REVERSELOCK_H
reverse_lock & operator=(reverse_lock const &)
Lock & lock
Definition: reverselock.h:31
reverse_lock(Lock &_lock)
Definition: reverselock.h:17
An RAII-style reverse lock.
Definition: reverselock.h:13