16 #include "llvm/Config/config.h" 23 #if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0 39 #if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_RWLOCK_INIT) 52 pthread_rwlock_t* rwlock =
53 static_cast<pthread_rwlock_t*
>(
safe_malloc(
sizeof(pthread_rwlock_t)));
57 bzero(rwlock,
sizeof(pthread_rwlock_t));
61 int errorcode = pthread_rwlock_init(rwlock,
nullptr);
72 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
74 pthread_rwlock_destroy(rwlock);
81 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
84 int errorcode = pthread_rwlock_rdlock(rwlock);
85 return errorcode == 0;
91 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
94 int errorcode = pthread_rwlock_unlock(rwlock);
95 return errorcode == 0;
101 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
102 assert(rwlock !=
nullptr);
104 int errorcode = pthread_rwlock_wrlock(rwlock);
105 return errorcode == 0;
111 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
112 assert(rwlock !=
nullptr);
114 int errorcode = pthread_rwlock_unlock(rwlock);
115 return errorcode == 0;
118 #elif defined(LLVM_ON_UNIX) 120 #elif defined( _WIN32) 123 #warning Neither LLVM_ON_UNIX nor _WIN32 was set in Support/Mutex.cpp
This class represents lattice values for constants.
bool reader_release()
Attempts to release the lock in reader mode.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
bool writer_acquire()
Attempts to unconditionally acquire the lock in reader mode.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
bool reader_acquire()
Attempts to unconditionally acquire the lock in reader mode.
RWMutexImpl()
Initializes the lock but doesn't acquire it.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool writer_release()
Attempts to release the lock in writer mode.
~RWMutexImpl()
Releases and removes the lock Destructor.