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