Go to the documentation of this file.
13 #ifndef LLVM_SUPPORT_RWMUTEX_H
14 #define LLVM_SUPPORT_RWMUTEX_H
16 #include "llvm/Config/llvm-config.h"
20 #include <shared_mutex>
23 #if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
24 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
25 #define LLVM_USE_RW_MUTEX_IMPL
32 #if defined(LLVM_USE_RW_MUTEX_IMPL)
40 explicit RWMutexImpl();
45 RWMutexImpl(
const RWMutexImpl &original) =
delete;
46 RWMutexImpl &operator=(
const RWMutexImpl &) =
delete;
85 #if defined(LLVM_ENABLE_THREADS) && LLVM_ENABLE_THREADS != 0
86 void *data_ =
nullptr;
97 #if defined(_MSC_VER) || __cplusplus > 201402L
98 std::shared_mutex impl;
100 #if !defined(LLVM_USE_RW_MUTEX_IMPL)
101 std::shared_timed_mutex
impl;
106 unsigned readers = 0;
107 unsigned writers = 0;
124 impl.unlock_shared();
130 assert(readers > 0 &&
"Reader lock not acquired before release!");
143 assert(writers == 0 &&
"Writer lock already acquired!");
156 assert(writers == 1 &&
"Writer lock not acquired before release!");
165 #if !defined(LLVM_USE_RW_MUTEX_IMPL)
166 template <
bool mt_only>
182 #if !defined(LLVM_USE_RW_MUTEX_IMPL)
183 template <
bool mt_only>
201 #endif // LLVM_SUPPORT_RWMUTEX_H
std::lock_guard< SmartRWMutex< mt_only > > SmartScopedWriter
ScopedWriter - RAII acquisition of a writer lock.
This is an optimization pass for GlobalISel generic memory operations.
place backedge safepoints impl
SmartScopedWriter< false > ScopedWriter
const std::shared_lock< SmartRWMutex< mt_only > > SmartScopedReader
ScopedReader - RAII acquisition of a reader lock.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SmartScopedReader< false > ScopedReader
SmartRWMutex< false > RWMutex
bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.
SmartMutex - An R/W mutex with a compile time constant parameter that indicates whether this mutex sh...