From f0eeb9b7f580a3e92c0a740893b7956801eafd52 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 18 Jun 2009 18:29:03 +0000 Subject: [PATCH] Simplify the SmartMutex implementation a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73711 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/System/Mutex.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/include/llvm/System/Mutex.h b/include/llvm/System/Mutex.h index f749c5d7067..d8a18865f68 100644 --- a/include/llvm/System/Mutex.h +++ b/include/llvm/System/Mutex.h @@ -86,31 +86,30 @@ namespace llvm /// indicates whether this mutex should become a no-op when we're not /// running in multithreaded mode. template - class SmartMutex { - MutexImpl mtx; + class SmartMutex : public MutexImpl { public: - explicit SmartMutex(bool recursive = true) : mtx(recursive) { } + explicit SmartMutex(bool recursive = true) : MutexImpl(recursive) { } bool acquire() { - if (!mt_only || (mt_only && llvm_is_multithreaded())) - return mtx.acquire(); + if (!mt_only && llvm_is_multithreaded()) + return MutexImpl::acquire(); return true; } bool release() { - if (!mt_only || (mt_only && llvm_is_multithreaded())) - return mtx.release(); + if (!mt_only || llvm_is_multithreaded()) + return MutexImpl::release(); return true; } bool tryacquire() { - if (!mt_only || (mt_only && llvm_is_multithreaded())) - return mtx.tryacquire(); + if (!mt_only || llvm_is_multithreaded()) + return MutexImpl::tryacquire(); return true; } private: - SmartMutex(const SmartMutex & original); + SmartMutex(const SmartMutex & original); void operator=(const SmartMutex &); };