diff options
author | Mike Klein <mtklein@chromium.org> | 2017-09-20 09:53:39 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-21 17:09:40 +0000 |
commit | 3b7658a4752e1332c684ad757686ce9ee0e5fbd1 (patch) | |
tree | dff539a1555c58e2bb9ea34c288acfc978906d35 /include/private/SkMutex.h | |
parent | f50f4a4c55ed4dea457d48010690bbe3f3c69530 (diff) |
Teach TSAN directly about semaphore_t.
Instead of teaching TSAN than SkMutex is a lock to get around it not
understanding Mach semaphore_t routines, teach it that there is a
happens-before relationship between semaphore_signal() and
semaphore_wait().
This reverts commit e395bf2d189e22822ddf2b46541c510d6d8fbcc0.
New changes are entirely restricted to SkSemaphore.cpp.
Change-Id: I27f647b93c48e81e8327db849881d669c4cd3d04
Reviewed-on: https://skia-review.googlesource.com/49180
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'include/private/SkMutex.h')
-rw-r--r-- | include/private/SkMutex.h | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/include/private/SkMutex.h b/include/private/SkMutex.h index da9a80b00e..7cfdb1132c 100644 --- a/include/private/SkMutex.h +++ b/include/private/SkMutex.h @@ -10,15 +10,10 @@ #include "../private/SkSemaphore.h" #include "../private/SkThreadID.h" -#include "SkTSAN.h" #include "SkTypes.h" #define SK_DECLARE_STATIC_MUTEX(name) static SkBaseMutex name; -// We use ANNOTE_RWLOCK_foo() macros in here because TSAN does -// not intercept Mach semaphore_t calls, and so on Mac can't -// see that SkMutex is indeed a mutex. - class SkBaseMutex { public: constexpr SkBaseMutex() = default; @@ -26,12 +21,10 @@ public: void acquire() { fSemaphore.wait(); SkDEBUGCODE(fOwner = SkGetThreadID();) - ANNOTATE_RWLOCK_ACQUIRED(&fSemaphore, true); } void release() { this->assertHeld(); - ANNOTATE_RWLOCK_RELEASED(&fSemaphore, true); SkDEBUGCODE(fOwner = kIllegalThreadID;) fSemaphore.signal(); } @@ -47,11 +40,8 @@ protected: class SkMutex : public SkBaseMutex { public: - SkMutex() { ANNOTATE_RWLOCK_CREATE(&fSemaphore); } - ~SkMutex() { - ANNOTATE_RWLOCK_DESTROY(&fSemaphore); - fSemaphore.cleanup(); - } + using SkBaseMutex::SkBaseMutex; + ~SkMutex() { fSemaphore.cleanup(); } }; class SkAutoMutexAcquire { |