threading: use correct mutex name in reverse_lock fatal error messages
Now that REVERSE_LOCK requires the name of the actual mutex, it can be used for better error messages.
This commit is contained in:
1 parent
a201a99f8c
commit
de4eef52d1
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -248,7 +248,7 @@ public:
|
|||||||
// it is not possible to use the lock's copy of the mutex for that purpose.
|
// it is not possible to use the lock's copy of the mutex for that purpose.
|
||||||
// Instead, the original mutex needs to be passed back to the reverse_lock for
|
// Instead, the original mutex needs to be passed back to the reverse_lock for
|
||||||
// the sake of thread-safety analysis, but it is not actually used otherwise.
|
// the sake of thread-safety analysis, but it is not actually used otherwise.
|
||||||
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #g, __FILE__, __LINE__)
|
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
|
||||||
|
|
||||||
// When locking a Mutex, require negative capability to ensure the lock
|
// When locking a Mutex, require negative capability to ensure the lock
|
||||||
// is not already held
|
// is not already held
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(reverselock_errors)
|
|||||||
g_debug_lockorder_abort = false;
|
g_debug_lockorder_abort = false;
|
||||||
|
|
||||||
// Make sure trying to reverse lock a previous lock fails
|
// Make sure trying to reverse lock a previous lock fails
|
||||||
BOOST_CHECK_EXCEPTION(REVERSE_LOCK(lock2, mutex2), std::logic_error, HasReason("lock2 was not most recent critical section locked"));
|
BOOST_CHECK_EXCEPTION(REVERSE_LOCK(lock2, mutex2), std::logic_error, HasReason("mutex2 was not most recent critical section locked"));
|
||||||
BOOST_CHECK(lock2.owns_lock());
|
BOOST_CHECK(lock2.owns_lock());
|
||||||
|
|
||||||
g_debug_lockorder_abort = prev;
|
g_debug_lockorder_abort = prev;
|
||||||
|
|||||||
Reference in new issue
Block a user