From 4b2e16763fbe70e7cdcf82b438d415e9d96f1674 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 21 Jul 2022 15:12:43 +0200 Subject: [PATCH] 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`. --- src/sync.h | 12 ++++++------ 1 file 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 -class SCOPED_LOCKABLE UniqueLock : public Mutex::UniqueLock +/** Wrapper around std::unique_lock style lock for MutexType. */ +template +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;