Skip to content

Commit 3df37e0

Browse files
committed
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.
1 parent bc35c4f commit 3df37e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc/developer-notes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,9 @@ Threads and synchronization
941941
internal to a class (private or protected) rather than public.
942942
943943
- Combine annotations in function declarations with run-time asserts in
944-
function definitions:
944+
function definitions (`AssertLockNotHeld()` can be omitted if `LOCK()` is
945+
called unconditionally after it because `LOCK()` does the same check as
946+
`AssertLockNotHeld()` internally, for non-recursive mutexes):
945947
946948
```C++
947949
// txmempool.h

0 commit comments

Comments
 (0)