| 13 | namespace { |
| 14 | template <typename MutexType> |
| 15 | void TestPotentialDeadLockDetected(MutexType& mutex1, MutexType& mutex2) |
| 16 | { |
| 17 | { |
| 18 | LOCK2(mutex1, mutex2); |
| 19 | } |
| 20 | BOOST_CHECK(LockStackEmpty()); |
| 21 | bool error_thrown = false; |
| 22 | try { |
| 23 | LOCK2(mutex2, mutex1); |
| 24 | } catch (const std::logic_error& e) { |
| 25 | BOOST_CHECK_EQUAL(e.what(), "potential deadlock detected: mutex1 -> mutex2 -> mutex1"); |
| 26 | error_thrown = true; |
| 27 | } |
| 28 | BOOST_CHECK(LockStackEmpty()); |
| 29 | #ifdef DEBUG_LOCKORDER |
| 30 | BOOST_CHECK(error_thrown); |
| 31 | #else |
| 32 | BOOST_CHECK(!error_thrown); |
| 33 | #endif |
| 34 | } |
| 35 | |
| 36 | #ifdef DEBUG_LOCKORDER |
| 37 | template <typename MutexType> |
no test coverage detected