aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkSharedMutex.cpp
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-05-14 17:23:07 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-15 14:59:53 +0000
commitf169e1f81fb2d81b7a0cc775ce6a7e1d7dfb62c2 (patch)
treed6ba18c06e5f04d28584a34d504a66f919bcba7a /src/core/SkSharedMutex.cpp
parent81f60ecd9cc0e7c507f9e1f05862bee6a19ee0c6 (diff)
SkSharedMutex::acquire to check thread state.
This makes SkSharedMutex::acquire() assert if a thread has already acquired a shared lock. Change-Id: I35a186a137b9efcad1132093e1bb18c8822e1538 Reviewed-on: https://skia-review.googlesource.com/128160 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'src/core/SkSharedMutex.cpp')
-rw-r--r--src/core/SkSharedMutex.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/SkSharedMutex.cpp b/src/core/SkSharedMutex.cpp
index 17714a7185..d3e7663bca 100644
--- a/src/core/SkSharedMutex.cpp
+++ b/src/core/SkSharedMutex.cpp
@@ -132,6 +132,9 @@
{
SkAutoMutexAcquire l(&fMu);
+ SkASSERTF(!fCurrentShared->find(threadID),
+ "Thread %lx already has an shared lock\n", threadID);
+
if (!fWaitingExclusive->tryAdd(threadID)) {
SkDEBUGFAILF("Thread %lx already has an exclusive lock\n", threadID);
}