From 3df37e0c78c3d5139c963a74eda56c331355ef72 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 17 Feb 2023 11:37:56 +0100 Subject: doc: clarify that LOCK() does AssertLockNotHeld() internally Constructs like ```cpp AssertLockNotHeld(m); LOCK(m); ``` are equivalent to ```cpp LOCK(m); ``` for non-recursive mutexes, so it is ok to omit `AssertLockNotHeld()` in such cases. --- doc/developer-notes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/developer-notes.md') diff --git a/doc/developer-notes.md b/doc/developer-notes.md index e2e54e13d3..d41543ab1c 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -941,7 +941,9 @@ Threads and synchronization internal to a class (private or protected) rather than public. - Combine annotations in function declarations with run-time asserts in - function definitions: + function definitions (`AssertLockNotHeld()` can be omitted if `LOCK()` is + called unconditionally after it because `LOCK()` does the same check as + `AssertLockNotHeld()` internally, for non-recursive mutexes): ```C++ // txmempool.h -- cgit v1.2.3