14 #include "llvm/Config/config.h"
23 #if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0
36 #if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_RWLOCK_INIT)
50 pthread_rwlock_t* rwlock =
51 static_cast<pthread_rwlock_t*
>(malloc(
sizeof(pthread_rwlock_t)));
55 bzero(rwlock,
sizeof(pthread_rwlock_t));
59 int errorcode = pthread_rwlock_init(rwlock,
nullptr);
70 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
72 pthread_rwlock_destroy(rwlock);
79 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
82 int errorcode = pthread_rwlock_rdlock(rwlock);
83 return errorcode == 0;
89 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
92 int errorcode = pthread_rwlock_unlock(rwlock);
93 return errorcode == 0;
99 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
100 assert(rwlock !=
nullptr);
102 int errorcode = pthread_rwlock_wrlock(rwlock);
103 return errorcode == 0;
109 pthread_rwlock_t* rwlock =
static_cast<pthread_rwlock_t*
>(data_);
110 assert(rwlock !=
nullptr);
112 int errorcode = pthread_rwlock_unlock(rwlock);
113 return errorcode == 0;
118 #elif defined(LLVM_ON_UNIX)
120 #elif defined( LLVM_ON_WIN32)
123 #warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 was set in Support/Mutex.cpp
~RWMutexImpl()
Releases and removes the lock.
bool writer_release()
Attempts to release the lock in writer 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.
bool reader_release()
Attempts to release the lock in reader mode.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())