Skip to content

Commit 4b2e167

Browse files
committed
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`.
1 parent 9d7ae4b commit 4b2e167

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/sync.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ inline void AssertLockNotHeldInline(const char* name, const char* file, int line
147147
inline void AssertLockNotHeldInline(const char* name, const char* file, int line, GlobalMutex* cs) LOCKS_EXCLUDED(cs) { AssertLockNotHeldInternal(name, file, line, cs); }
148148
#define AssertLockNotHeld(cs) AssertLockNotHeldInline(#cs, __FILE__, __LINE__, &cs)
149149

150-
/** Wrapper around std::unique_lock style lock for Mutex. */
151-
template <typename Mutex>
152-
class SCOPED_LOCKABLE UniqueLock : public Mutex::UniqueLock
150+
/** Wrapper around std::unique_lock style lock for MutexType. */
151+
template <typename MutexType>
152+
class SCOPED_LOCKABLE UniqueLock : public MutexType::UniqueLock
153153
{
154154
private:
155-
using Base = typename Mutex::UniqueLock;
155+
using Base = typename MutexType::UniqueLock;
156156

157157
void Enter(const char* pszName, const char* pszFile, int nLine)
158158
{
@@ -175,15 +175,15 @@ class SCOPED_LOCKABLE UniqueLock : public Mutex::UniqueLock
175175
}
176176

177177
public:
178-
UniqueLock(Mutex& mutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(mutexIn) : Base(mutexIn, std::defer_lock)
178+
UniqueLock(MutexType& mutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(mutexIn) : Base(mutexIn, std::defer_lock)
179179
{
180180
if (fTry)
181181
TryEnter(pszName, pszFile, nLine);
182182
else
183183
Enter(pszName, pszFile, nLine);
184184
}
185185

186-
UniqueLock(Mutex* pmutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(pmutexIn)
186+
UniqueLock(MutexType* pmutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(pmutexIn)
187187
{
188188
if (!pmutexIn) return;
189189

0 commit comments

Comments
 (0)