asan: fix compilation errors in mutex

llvm-svn: 172385
This commit is contained in:
Dmitry Vyukov 2013-01-14 08:01:58 +00:00
parent 59b8e701d3
commit af4b0b084a
3 changed files with 3 additions and 4 deletions

View File

@ -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);
} }

View File

@ -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 {

View File

@ -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>