diff options
author | Andrew Chow <github@achow101.com> | 2023-10-26 14:57:10 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-10-26 15:02:13 -0400 |
commit | e789b30b2565c8bdbf48a45f2c5a7b92e5d61d25 (patch) | |
tree | 975bd930805c903f465cfa5c23126535b17d3556 /src/test | |
parent | b72cb7801b2c0a6be33a90204f92944b9797f8b7 (diff) | |
parent | 91d08889218e06631f43a3dab0bae576aa46e43c (diff) | |
download | bitcoin-e789b30b2565c8bdbf48a45f2c5a7b92e5d61d25.tar.xz |
Merge bitcoin/bitcoin#27116: doc: clarify that LOCK() internally checks whether the mutex is held
91d08889218e06631f43a3dab0bae576aa46e43c sync: unpublish LocksHeld() which is used only in sync.cpp (Vasil Dimov)
3df37e0c78c3d5139c963a74eda56c331355ef72 doc: clarify that LOCK() does AssertLockNotHeld() internally (Vasil Dimov)
Pull request description:
Constructs like
```cpp
AssertLockNotHeld(m);
LOCK(m);
```
are equivalent to (almost, modulo some logging differences, see below)
```cpp
LOCK(m);
```
for non-recursive mutexes, so it is ok to omit `AssertLockNotHeld()` in such cases. Requests to do the former keep coming during review process. `developer-notes.md` explicitly states "Combine annotations in function declarations with run-time asserts in function definitions", but that seems to be too strong or unclear. `LOCK()` is also a run-time assert in this case.
Also remove `LocksHeld()` from the public interface in `sync.h` since it is only used in `sync.cpp`.
ACKs for top commit:
achow101:
ACK 91d08889218e06631f43a3dab0bae576aa46e43c
hebasto:
ACK 91d08889218e06631f43a3dab0bae576aa46e43c, I have reviewed the code and it looks OK.
Tree-SHA512: c4b7ef2c0bfeb28d1c4f55f497810f629873137e02f5a92137c02cb1ff603ac76473dcd2171e594491494a5cb87b8c0c803e06b86f190d4acb231791e28e802d
Diffstat (limited to 'src/test')
0 files changed, 0 insertions, 0 deletions