diff options
author | Francis Ricci <francisjricci@gmail.com> | 2017-02-09 19:29:11 +0000 |
---|---|---|
committer | Francis Ricci <francisjricci@gmail.com> | 2017-02-09 19:29:11 +0000 |
commit | fc4a9bfb5dfdb119894a2a34aff047d14dad0198 (patch) | |
tree | aeff5cdb16625844f95403174e9b7dfa4f657c63 /lib/sanitizer_common/sanitizer_mutex.h | |
parent | 865d9b5811608540e65e4fffd46e0389a13f3d99 (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_mutex.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_mutex.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_mutex.h b/lib/sanitizer_common/sanitizer_mutex.h index d06fc45ff..1759bf13f 100644 --- a/lib/sanitizer_common/sanitizer_mutex.h +++ b/lib/sanitizer_common/sanitizer_mutex.h @@ -83,6 +83,14 @@ class BlockingMutex { BlockingMutex(); void Lock(); void Unlock(); + + // This function does not guarantee an explicit check that the calling thread + // is the thread which owns the mutex. This behavior, while more strictly + // correct, causes problems in cases like StopTheWorld, where a parent thread + // owns the mutex but a child checks that it is locked. Rather than + // maintaining complex state to work around those situations, the check only + // checks that the mutex is owned, and assumes callers to be generally + // well-behaved. void CheckLocked(); private: uptr opaque_storage_[10]; |