Skip to content

Commit d33c111

Browse files
committed
Merge bitcoin/bitcoin#32829: threading: use correct mutex name in reverse_lock fatal error messages
de4eef5 threading: use correct mutex name in reverse_lock fatal error messages (Cory Fields) Pull request description: "Now that REVERSE_LOCK requires the name of the actual mutex, it can be used for better error messages." - theuni This is a follow-up to this comment bitcoin/bitcoin#32465 (comment) I just cherry-picked the commit 85c2848eb575f4abaa81fdd4e8f3b2048693dd98 ACKs for top commit: theuni: Re-ACK de4eef5 TheCharlatan: ACK de4eef5 Tree-SHA512: 1109381e1f0589093f7c737cb1ebd1c43324a9e1ea34b5f05a9171d06ab44cca0c5ead43c581f6e37ded1f0463ab8a280f3319c288d39a4625109b5c08a7cb68
2 parents e3f416d + de4eef5 commit d33c111

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/sync.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class SCOPED_LOCKABLE UniqueLock : public MutexType::unique_lock
248248
// it is not possible to use the lock's copy of the mutex for that purpose.
249249
// Instead, the original mutex needs to be passed back to the reverse_lock for
250250
// the sake of thread-safety analysis, but it is not actually used otherwise.
251-
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #g, __FILE__, __LINE__)
251+
#define REVERSE_LOCK(g, cs) typename std::decay<decltype(g)>::type::reverse_lock UNIQUE_NAME(revlock)(g, cs, #cs, __FILE__, __LINE__)
252252

253253
// When locking a Mutex, require negative capability to ensure the lock
254254
// is not already held

src/test/reverselock_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(reverselock_errors)
5454
g_debug_lockorder_abort = false;
5555

5656
// Make sure trying to reverse lock a previous lock fails
57-
BOOST_CHECK_EXCEPTION(REVERSE_LOCK(lock2, mutex2), std::logic_error, HasReason("lock2 was not most recent critical section locked"));
57+
BOOST_CHECK_EXCEPTION(REVERSE_LOCK(lock2, mutex2), std::logic_error, HasReason("mutex2 was not most recent critical section locked"));
5858
BOOST_CHECK(lock2.owns_lock());
5959

6060
g_debug_lockorder_abort = prev;

0 commit comments

Comments
 (0)