Use the variable name _ for unused return values
[bitcoinplatinum.git] / src / reverselock.h
blob9d9cc9fd77c8f183f694cc20f40cb48dbd1e46ea
1 // Copyright (c) 2015-2016 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.
5 #ifndef BITCOIN_REVERSELOCK_H
6 #define BITCOIN_REVERSELOCK_H
8 /**
9 * An RAII-style reverse lock. Unlocks on construction and locks on destruction.
11 template<typename Lock>
12 class reverse_lock
14 public:
16 explicit reverse_lock(Lock& _lock) : lock(_lock) {
17 _lock.unlock();
18 _lock.swap(templock);
21 ~reverse_lock() {
22 templock.lock();
23 templock.swap(lock);
26 private:
27 reverse_lock(reverse_lock const&);
28 reverse_lock& operator=(reverse_lock const&);
30 Lock& lock;
31 Lock templock;
34 #endif // BITCOIN_REVERSELOCK_H