14 #ifndef LLVM_SUPPORT_MUTEX_H
15 #define LLVM_SUPPORT_MUTEX_H
37 explicit MutexImpl(
bool recursive =
true);
73 #if defined(LLVM_ENABLE_THREADS) && LLVM_ENABLE_THREADS != 0
82 void operator=(
const MutexImpl &) =
delete;
90 template<
bool mt_only>
97 impl(rec), acquired(0), recursive(rec) { }
106 assert((recursive || acquired == 0) &&
"Lock already acquired!!");
119 assert(((recursive && acquired) || (acquired == 1)) &&
120 "Lock not acquired before release!");
140 template<
bool mt_only>
bool acquire()
Attempts to unconditionally acquire the lock.
SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should ...
SmartMutex(bool rec=true)
bool release()
Attempts to release the lock.
SmartMutex< false > Mutex
Mutex - A standard, always enforced mutex.
MutexImpl(bool recursive=true)
Initializes the lock but doesn't acquire it.
bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
SmartScopedLock< false > ScopedLock
Platform agnostic Mutex class.
SmartScopedLock(SmartMutex< mt_only > &m)
~MutexImpl()
Releases and removes the lock.
bool tryacquire()
Attempts to acquire the lock without blocking.