diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:17:27 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:17:27 +0000 |
commit | 67c32a98315f785a9ec9d531c1f571a0196c7463 (patch) | |
tree | 4abb9cbeecc7901726dd0b4a37369596c852e9ef /include/llvm/Support/Mutex.h | |
parent | 9f61947910e6ab40de38e6b4034751ef1513200f (diff) |
Diffstat (limited to 'include/llvm/Support/Mutex.h')
-rw-r--r-- | include/llvm/Support/Mutex.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/include/llvm/Support/Mutex.h b/include/llvm/Support/Mutex.h index 496a4381f3fc..97dd50115322 100644 --- a/include/llvm/Support/Mutex.h +++ b/include/llvm/Support/Mutex.h @@ -86,16 +86,17 @@ namespace llvm /// indicates whether this mutex should become a no-op when we're not /// running in multithreaded mode. template<bool mt_only> - class SmartMutex : public MutexImpl { + class SmartMutex { + MutexImpl impl; unsigned acquired; bool recursive; public: explicit SmartMutex(bool rec = true) : - MutexImpl(rec), acquired(0), recursive(rec) { } + impl(rec), acquired(0), recursive(rec) { } - bool acquire() { + bool lock() { if (!mt_only || llvm_is_multithreaded()) { - return MutexImpl::acquire(); + return impl.acquire(); } else { // Single-threaded debugging code. This would be racy in // multithreaded mode, but provides not sanity checks in single @@ -106,9 +107,9 @@ namespace llvm } } - bool release() { + bool unlock() { if (!mt_only || llvm_is_multithreaded()) { - return MutexImpl::release(); + return impl.release(); } else { // Single-threaded debugging code. This would be racy in // multithreaded mode, but provides not sanity checks in single @@ -120,9 +121,9 @@ namespace llvm } } - bool tryacquire() { + bool try_lock() { if (!mt_only || llvm_is_multithreaded()) - return MutexImpl::tryacquire(); + return impl.tryacquire(); else return true; } @@ -140,11 +141,11 @@ namespace llvm public: SmartScopedLock(SmartMutex<mt_only>& m) : mtx(m) { - mtx.acquire(); + mtx.lock(); } ~SmartScopedLock() { - mtx.release(); + mtx.unlock(); } }; |