diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 322fa987aea6c..791c049a4ab44 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -950,7 +950,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 diff --git a/src/sync.cpp b/src/sync.cpp index 46218056539be..58752a9f182de 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -246,7 +246,7 @@ void LeaveCritical() pop_lock(); } -std::string LocksHeld() +static std::string LocksHeld() { LockData& lockdata = GetLockData(); std::lock_guard lock(lockdata.dd_mutex); diff --git a/src/sync.h b/src/sync.h index 45d40b5fdc377..dc63e3f2d0c04 100644 --- a/src/sync.h +++ b/src/sync.h @@ -57,7 +57,6 @@ template 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 void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(cs); template