aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/developer-notes.md4
-rw-r--r--src/sync.cpp2
-rw-r--r--src/sync.h1
3 files changed, 4 insertions, 3 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index 322fa987ae..791c049a4a 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 4621805653..58752a9f18 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<std::mutex> lock(lockdata.dd_mutex);
diff --git a/src/sync.h b/src/sync.h
index 45d40b5fdc..dc63e3f2d0 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -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>