~ubuntu-branches/debian/stretch/bitcoin/stretch

« back to all changes in this revision

Viewing changes to src/test/reverselock_tests.cpp

  • Committer: Package Import Robot
  • Author(s): Anthony Towns
  • Date: 2016-10-21 17:13:13 UTC
  • mfrom: (1.3.2)
  • Revision ID: package-import@ubuntu.com-20161021171313-7eu2ltpbk0xag3q1
Tags: 0.13.0-0.1
* Non-maintainer upload.
* New upstream release.
* Allow compilation with gcc/g++ 6. (Closes: Bug#835963)
* Additional fixes for openssl 1.1 compatibility. (See Bug#828248)
* Check if -latomic is needed (it is on mips*).
* Remove reproducible build patch, since leveldb build system is
  no longer used in 0.13. (See Bug#791834)
* Update description since the blockchain is much more than "several GB"
  now. (Closes: Bug#835809)

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
    BOOST_CHECK(failed);
43
43
    BOOST_CHECK(!lock.owns_lock());
44
44
 
45
 
    // Make sure trying to lock a lock after it has been reverse locked fails
46
 
    failed = false;
47
 
    bool locked = false;
 
45
    // Locking the original lock after it has been taken by a reverse lock
 
46
    // makes no sense. Ensure that the original lock no longer owns the lock
 
47
    // after giving it to a reverse one.
48
48
 
49
49
    lock.lock();
50
50
    BOOST_CHECK(lock.owns_lock());
51
 
 
52
 
    try {
 
51
    {
53
52
        reverse_lock<boost::unique_lock<boost::mutex> > rlock(lock);
54
 
        lock.lock();
55
 
        locked = true;
56
 
    } catch(...) {
57
 
        failed = true;
 
53
        BOOST_CHECK(!lock.owns_lock());
58
54
    }
59
55
 
60
 
    BOOST_CHECK(locked && failed);
 
56
    BOOST_CHECK(failed);
61
57
    BOOST_CHECK(lock.owns_lock());
62
58
}
63
59