diff options
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/System/Mutex.h | 8 | ||||
-rw-r--r-- | include/llvm/System/RWMutex.h | 18 |
2 files changed, 12 insertions, 14 deletions
diff --git a/include/llvm/System/Mutex.h b/include/llvm/System/Mutex.h index d2c457d..9ef5942 100644 --- a/include/llvm/System/Mutex.h +++ b/include/llvm/System/Mutex.h @@ -131,15 +131,15 @@ namespace llvm template<bool mt_only> class SmartScopedLock { - SmartMutex<mt_only>* mtx; + SmartMutex<mt_only>& mtx; public: - SmartScopedLock(SmartMutex<mt_only>* m) : mtx(m) { - mtx->acquire(); + SmartScopedLock(SmartMutex<mt_only>& m) : mtx(m) { + mtx.acquire(); } ~SmartScopedLock() { - mtx->release(); + mtx.release(); } }; diff --git a/include/llvm/System/RWMutex.h b/include/llvm/System/RWMutex.h index e577d45..3a28818 100644 --- a/include/llvm/System/RWMutex.h +++ b/include/llvm/System/RWMutex.h @@ -141,15 +141,14 @@ namespace llvm /// ScopedReader - RAII acquisition of a reader lock template<bool mt_only> struct SmartScopedReader { - SmartRWMutex<mt_only>* mutex; + SmartRWMutex<mt_only>& mutex; - explicit SmartScopedReader(SmartRWMutex<mt_only>* m) { - mutex = m; - mutex->reader_acquire(); + explicit SmartScopedReader(SmartRWMutex<mt_only>& m) : mutex(m) { + mutex.reader_acquire(); } ~SmartScopedReader() { - mutex->reader_release(); + mutex.reader_release(); } }; typedef SmartScopedReader<false> ScopedReader; @@ -157,15 +156,14 @@ namespace llvm /// ScopedWriter - RAII acquisition of a writer lock template<bool mt_only> struct SmartScopedWriter { - SmartRWMutex<mt_only>* mutex; + SmartRWMutex<mt_only>& mutex; - explicit SmartScopedWriter(SmartRWMutex<mt_only>* m) { - mutex = m; - mutex->writer_acquire(); + explicit SmartScopedWriter(SmartRWMutex<mt_only>& m) : mutex(m) { + mutex.writer_acquire(); } ~SmartScopedWriter() { - mutex->writer_release(); + mutex.writer_release(); } }; typedef SmartScopedWriter<false> ScopedWriter; |