[llvm-commits] [llvm] r73711 - /llvm/trunk/include/llvm/System/Mutex.h
Owen Anderson
resistor at mac.com
Thu Jun 18 11:29:04 PDT 2009
Author: resistor
Date: Thu Jun 18 13:29:03 2009
New Revision: 73711
URL: http://llvm.org/viewvc/llvm-project?rev=73711&view=rev
Log:
Simplify the SmartMutex implementation a bit.
Modified:
llvm/trunk/include/llvm/System/Mutex.h
Modified: llvm/trunk/include/llvm/System/Mutex.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Mutex.h?rev=73711&r1=73710&r2=73711&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Mutex.h (original)
+++ llvm/trunk/include/llvm/System/Mutex.h Thu Jun 18 13:29:03 2009
@@ -86,31 +86,30 @@
/// indicates whether this mutex should become a no-op when we're not
/// running in multithreaded mode.
template<bool mt_only>
- 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<mt_only>(const SmartMutex<mt_only> & original);
+ SmartMutex(const SmartMutex<mt_only> & original);
void operator=(const SmartMutex<mt_only> &);
};
More information about the llvm-commits
mailing list