diff options
author | mtklein <mtklein@chromium.org> | 2014-06-09 14:18:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-09 14:18:03 -0700 |
commit | b83f6c3cbdabc14d8290b00d9f38ba59bf6719a1 (patch) | |
tree | a27fbddc35397dc0f32549e2af8a9c6d13e9c641 /include | |
parent | 919ed4c73633e92bfc6694161360c5c3f45728e8 (diff) |
Add assertHeld() to SkMutex.
BUG=skia:
R=bungeman@google.com, mtklein@google.com, reed@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/313823004
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkThread.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/core/SkThread.h b/include/core/SkThread.h index 3038e2d954..4f7f326097 100644 --- a/include/core/SkThread.h +++ b/include/core/SkThread.h @@ -83,8 +83,9 @@ template <typename T> void sk_release_store(T*, T); class SkBaseMutex { public: - void acquire(); - void release(); + void acquire(); // Block until this thread owns the mutex. + void release(); // Assuming this thread owns the mutex, release it. + void assertHeld(); // If SK_DEBUG, assert this thread owns the mutex. }; class SkMutex : SkBaseMutex { @@ -128,6 +129,12 @@ public: } } + /** Assert that we're holding the mutex. */ + void assertHeld() { + SkASSERT(fMutex); + fMutex->assertHeld(); + } + private: SkBaseMutex* fMutex; }; |