MCPcopy Create free account
hub / github.com/ElementsProject/elements / TestPotentialDeadLockDetected

Function TestPotentialDeadLockDetected

src/test/sync_tests.cpp:15–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13namespace {
14template <typename MutexType>
15void 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
37template <typename MutexType>

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 1

LockStackEmptyFunction · 0.50

Tested by

no test coverage detected