15 #include "llvm/Config/config.h"
22 #if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0
38 #if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_RWLOCK_INIT)
51 pthread_rwlock_t* rwlock =
52 static_cast<pthread_rwlock_t*
>(malloc(
sizeof(pthread_rwlock_t)));
56 bzero(rwlock,
sizeof(pthread_rwlock_t));
60 int errorcode = pthread_rwlock_init(rwlock,
nullptr);
71 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
73 pthread_rwlock_destroy(rwlock);
80 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
83 int errorcode = pthread_rwlock_rdlock(rwlock);
84 return errorcode == 0;
90 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
93 int errorcode = pthread_rwlock_unlock(rwlock);
94 return errorcode == 0;
100 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
101 assert(rwlock !=
nullptr);
103 int errorcode = pthread_rwlock_wrlock(rwlock);
104 return errorcode == 0;
110 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
111 assert(rwlock !=
nullptr);
113 int errorcode = pthread_rwlock_unlock(rwlock);
114 return errorcode == 0;
117 #elif defined(LLVM_ON_UNIX)
119 #elif defined( LLVM_ON_WIN32)
122 #warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 was set in Support/Mutex.cpp
bool reader_release()
Attempts to release the lock in reader mode.
bool writer_acquire()
Attempts to unconditionally acquire the lock in reader mode.
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.