aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sync.h')
-rw-r--r--src/sync.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sync.h b/src/sync.h
index 7891e41560..27e80e813b 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -142,6 +142,17 @@ public:
Enter(pszName, pszFile, nLine);
}
+ CMutexLock(Mutex* pmutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false)
+ {
+ if (!pmutexIn) return;
+
+ lock = boost::unique_lock<Mutex>(*pmutexIn, boost::defer_lock);
+ if (fTry)
+ TryEnter(pszName, pszFile, nLine);
+ else
+ Enter(pszName, pszFile, nLine);
+ }
+
~CMutexLock()
{
if (lock.owns_lock())