forked from OSchip/llvm-project
parent
59b8e701d3
commit
af4b0b084a
|
@ -457,10 +457,7 @@ void BlockingMutex::Lock() {
|
|||
void BlockingMutex::Unlock() {
|
||||
atomic_uint32_t *m = reinterpret_cast<atomic_uint32_t *>(&opaque_storage_);
|
||||
u32 v = atomic_exchange(m, MtxUnlocked, memory_order_relaxed);
|
||||
if (v == MtxUnlocked) {
|
||||
Printf("FATAL: unlock of unlocked mutex\n");
|
||||
Die();
|
||||
}
|
||||
CHECK_NE(v, MtxUnlocked);
|
||||
if (v == MtxSleeping)
|
||||
syscall(__NR_futex, m, FUTEX_WAKE_PRIVATE, 1, 0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
||||
namespace __sanitizer {
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ class BlockingMutex {
|
|||
void Unlock();
|
||||
private:
|
||||
uptr opaque_storage_[10];
|
||||
uptr owner_; // for debugging
|
||||
};
|
||||
|
||||
template<typename MutexType>
|
||||
|
|
Loading…
Reference in New Issue