Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Unified Diff: src/core/SkSharedMutex.h

Issue 1417583005: Add lighter weight lock guards. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/private/SkMutex.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkSharedMutex.h
diff --git a/src/core/SkSharedMutex.h b/src/core/SkSharedMutex.h
index ea948d3f6c90bdf03cce8be77c609b32f541f5c5..840c2d36adf152b50087675eb1140c78001dd407 100644
--- a/src/core/SkSharedMutex.h
+++ b/src/core/SkSharedMutex.h
@@ -69,4 +69,14 @@ inline void SkSharedMutex::assertHeld() const {};
inline void SkSharedMutex::assertHeldShared() const {};
#endif // SK_DEBUG
+class SkAutoSharedMutexShared {
bungeman-skia 2015/10/21 21:19:09 After some thinking about it I do get the name, bu
+public:
+ SkAutoSharedMutexShared(SkSharedMutex& lock) : fLock(lock) { lock.acquireShared(); }
+ ~SkAutoSharedMutexShared() { fLock.releaseShared(); }
+private:
+ SkSharedMutex& fLock;
+};
+
+#define SkAutoSharedMutexShared(...) SK_REQUIRE_LOCAL_VAR(SkAutoSharedMutexShared)
+
#endif // SkSharedLock_DEFINED
« no previous file with comments | « include/private/SkMutex.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698