Page MenuHomePhabricator

D7879.diff
No OneTemporary

D7879.diff

diff --git a/src/sync.h b/src/sync.h
--- a/src/sync.h
+++ b/src/sync.h
@@ -53,8 +53,9 @@
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,
- void *cs) ASSERT_EXCLUSIVE_LOCK(cs);
+ MutexType *cs) ASSERT_EXCLUSIVE_LOCK(cs);
void AssertLockNotHeldInternal(const char *pszName, const char *pszFile,
int nLine, void *cs);
void DeleteLock(void *cs);
@@ -72,9 +73,11 @@
static inline void CheckLastCritical(void *cs, std::string &lockname,
const char *guardname, const char *file,
int line) {}
+template <typename MutexType>
static inline void AssertLockHeldInternal(const char *pszName,
const char *pszFile, int nLine,
- void *cs) ASSERT_EXCLUSIVE_LOCK(cs) {}
+ MutexType *cs)
+ ASSERT_EXCLUSIVE_LOCK(cs) {}
static inline void AssertLockNotHeldInternal(const char *pszName,
const char *pszFile, int nLine,
void *cs) {}
diff --git a/src/sync.cpp b/src/sync.cpp
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -218,8 +218,9 @@
return false;
}
+template <typename MutexType>
void AssertLockHeldInternal(const char *pszName, const char *pszFile, int nLine,
- void *cs) {
+ MutexType *cs) {
if (LockHeld(cs)) {
return;
}
@@ -228,6 +229,9 @@
pszName, pszFile, nLine, LocksHeld());
abort();
}
+template void AssertLockHeldInternal(const char *, const char *, int, Mutex *);
+template void AssertLockHeldInternal(const char *, const char *, int,
+ RecursiveMutex *);
void AssertLockNotHeldInternal(const char *pszName, const char *pszFile,
int nLine, void *cs) {

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 1, 11:03 (15 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187464
Default Alt Text
D7879.diff (2 KB)

Event Timeline