LCOV - code coverage report
Current view: top level - src - reverselock.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 3 6 50.0 %
Date: 2015-10-12 22:39:14 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2015 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 BITCOIN_REVERSELOCK_H
       6             : #define BITCOIN_REVERSELOCK_H
       7             : 
       8             : /**
       9             :  * An RAII-style reverse lock. Unlocks on construction and locks on destruction.
      10             :  */
      11             : template<typename Lock>
      12             : class reverse_lock
      13             : {
      14             : public:
      15             : 
      16         403 :     explicit reverse_lock(Lock& lock) : lock(lock) {
      17         403 :         lock.unlock();
      18           0 :     }
      19             : 
      20           0 :     ~reverse_lock() {
      21         402 :         lock.lock();
      22           0 :     }
      23             : 
      24             : private:
      25             :     reverse_lock(reverse_lock const&);
      26             :     reverse_lock& operator=(reverse_lock const&);
      27             : 
      28             :     Lock& lock;
      29             : };
      30             : 
      31             : #endif // BITCOIN_REVERSELOCK_H

Generated by: LCOV version 1.11