mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
Merge bitcoin/bitcoin#27116: doc: clarify that LOCK() internally checks whether the mutex is held
91d0888921sync: unpublish LocksHeld() which is used only in sync.cpp (Vasil Dimov)3df37e0c78doc: 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: ACK91d0888921hebasto: ACK91d0888921, I have reviewed the code and it looks OK. Tree-SHA512: c4b7ef2c0bfeb28d1c4f55f497810f629873137e02f5a92137c02cb1ff603ac76473dcd2171e594491494a5cb87b8c0c803e06b86f190d4acb231791e28e802d
This commit is contained in:
@@ -57,7 +57,6 @@ template <typename MutexType>
|
||||
void EnterCritical(const char* pszName, const char* pszFile, int nLine, MutexType* cs, bool fTry = false);
|
||||
void LeaveCritical();
|
||||
void CheckLastCritical(void* cs, std::string& lockname, const char* guardname, const char* file, int line);
|
||||
std::string LocksHeld();
|
||||
template <typename MutexType>
|
||||
void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(cs);
|
||||
template <typename MutexType>
|
||||
|
||||
Reference in New Issue
Block a user