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