aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2022-07-21 15:12:43 +0200
committerVasil Dimov <vd@FreeBSD.org>2022-10-10 09:20:45 +0200
commit4b2e16763fbe70e7cdcf82b438d415e9d96f1674 (patch)
tree322a2f1084c5b80d44c8ad1e3bb6723c6933cd56 /src/sync.h
parent9d7ae4b66c9ce202d51286daac9be7e599d6a629 (diff)
downloadbitcoin-4b2e16763fbe70e7cdcf82b438d415e9d96f1674.tar.xz
sync: avoid confusing name overlap (Mutex)
Use `MutexType` instead of `Mutex` for the template parameter of `UniqueLock` because there is already a class named `Mutex` and the naming overlap is confusing. `MutexType` is used elsewhere in `sync.h`.
Diffstat (limited to 'src/sync.h')
-rw-r--r--src/sync.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sync.h b/src/sync.h
index f6d9a6cbe5..730d599bd9 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -147,12 +147,12 @@ inline void AssertLockNotHeldInline(const char* name, const char* file, int line
inline void AssertLockNotHeldInline(const char* name, const char* file, int line, GlobalMutex* cs) LOCKS_EXCLUDED(cs) { AssertLockNotHeldInternal(name, file, line, cs); }
#define AssertLockNotHeld(cs) AssertLockNotHeldInline(#cs, __FILE__, __LINE__, &cs)
-/** Wrapper around std::unique_lock style lock for Mutex. */
-template <typename Mutex>
-class SCOPED_LOCKABLE UniqueLock : public Mutex::UniqueLock
+/** Wrapper around std::unique_lock style lock for MutexType. */
+template <typename MutexType>
+class SCOPED_LOCKABLE UniqueLock : public MutexType::UniqueLock
{
private:
- using Base = typename Mutex::UniqueLock;
+ using Base = typename MutexType::UniqueLock;
void Enter(const char* pszName, const char* pszFile, int nLine)
{
@@ -175,7 +175,7 @@ private:
}
public:
- UniqueLock(Mutex& mutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(mutexIn) : Base(mutexIn, std::defer_lock)
+ UniqueLock(MutexType& mutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(mutexIn) : Base(mutexIn, std::defer_lock)
{
if (fTry)
TryEnter(pszName, pszFile, nLine);
@@ -183,7 +183,7 @@ public:
Enter(pszName, pszFile, nLine);
}
- UniqueLock(Mutex* pmutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(pmutexIn)
+ UniqueLock(MutexType* pmutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(pmutexIn)
{
if (!pmutexIn) return;