summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_mac.cc
diff options
context:
space:
mode:
authorFrancis Ricci <francisjricci@gmail.com>2017-02-09 19:29:11 +0000
committerFrancis Ricci <francisjricci@gmail.com>2017-02-09 19:29:11 +0000
commitfc4a9bfb5dfdb119894a2a34aff047d14dad0198 (patch)
treeaeff5cdb16625844f95403174e9b7dfa4f657c63 /lib/sanitizer_common/sanitizer_mac.cc
parent865d9b5811608540e65e4fffd46e0389a13f3d99 (diff)
Remove strict tid checks from the mac implementation of BlockingMutex
Summary: This patch unifies the behavior of BlockingMutex on linux and mac, resolving problems that can arise when BlockingMutex is used in code shared by the two platforms but has different behavior depending on the platform. No longer requires that the calling thread own the mutex for CheckLocked calls to pass. Reviewers: dvyukov, kubamracek Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29728 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_mac.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_mac.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/sanitizer_common/sanitizer_mac.cc b/lib/sanitizer_common/sanitizer_mac.cc
index 43dc7de35..2074b711e 100644
--- a/lib/sanitizer_common/sanitizer_mac.cc
+++ b/lib/sanitizer_common/sanitizer_mac.cc
@@ -348,20 +348,16 @@ BlockingMutex::BlockingMutex() {
void BlockingMutex::Lock() {
CHECK(sizeof(OSSpinLock) <= sizeof(opaque_storage_));
CHECK_EQ(OS_SPINLOCK_INIT, 0);
- CHECK_NE(owner_, (uptr)pthread_self());
+ CHECK_EQ(owner_, 0);
OSSpinLockLock((OSSpinLock*)&opaque_storage_);
- CHECK(!owner_);
- owner_ = (uptr)pthread_self();
}
void BlockingMutex::Unlock() {
- CHECK(owner_ == (uptr)pthread_self());
- owner_ = 0;
OSSpinLockUnlock((OSSpinLock*)&opaque_storage_);
}
void BlockingMutex::CheckLocked() {
- CHECK_EQ((uptr)pthread_self(), owner_);
+ CHECK_NE(*(OSSpinLock*)&opaque_storage_, 0);
}
u64 NanoTime() {