14 #ifndef LLVM_SUPPORT_RWMUTEX_H
15 #define LLVM_SUPPORT_RWMUTEX_H
73 #if defined(LLVM_ENABLE_THREADS) && LLVM_ENABLE_THREADS != 0
89 template<
bool mt_only>
92 unsigned readers, writers;
112 assert(readers > 0 &&
"Reader lock not acquired before release!");
123 assert(writers == 0 &&
"Writer lock already acquired!");
134 assert(writers == 1 &&
"Writer lock not acquired before release!");
146 template<
bool mt_only>
155 mutex.unlock_shared();
161 template<
bool mt_only>
SmartRWMutex< mt_only > & mutex
~RWMutexImpl()
Releases and removes the lock.
SmartRWMutex< false > RWMutex
SmartMutex - An R/W mutex with a compile time constant parameter that indicates whether this mutex sh...
bool writer_release()
Attempts to release the lock in writer mode.
bool writer_acquire()
Attempts to unconditionally acquire the lock in reader mode.
ScopedReader - RAII acquisition of a reader lock.
ScopedWriter - RAII acquisition of a writer lock.
bool reader_acquire()
Attempts to unconditionally acquire the lock in reader mode.
RWMutexImpl()
Initializes the lock but doesn't acquire it.
Platform agnostic RWMutex class.
bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
SmartRWMutex< mt_only > & mutex
SmartScopedReader< false > ScopedReader
SmartScopedReader(SmartRWMutex< mt_only > &m)
SmartScopedWriter< false > ScopedWriter
SmartScopedWriter(SmartRWMutex< mt_only > &m)
bool reader_release()
Attempts to release the lock in reader mode.