aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/System/Mutex.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/System/Mutex.h')
-rw-r--r--include/llvm/System/Mutex.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/System/Mutex.h b/include/llvm/System/Mutex.h
index d8a18865f6..6f5614f701 100644
--- a/include/llvm/System/Mutex.h
+++ b/include/llvm/System/Mutex.h
@@ -115,6 +115,22 @@ namespace llvm
/// Mutex - A standard, always enforced mutex.
typedef SmartMutex<false> Mutex;
+
+ template<bool mt_only>
+ class SmartScopedLock {
+ SmartMutex<mt_only>* mtx;
+
+ public:
+ SmartScopedLock(SmartMutex<mt_only>* m) : mtx(m) {
+ mtx->acquire();
+ }
+
+ ~SmartScopedLock() {
+ mtx->release();
+ }
+ };
+
+ typedef SmartScopedLock<false> ScopedLock;
}
}