| Index: include/private/SkMutex.h
|
| diff --git a/include/private/SkMutex.h b/include/private/SkMutex.h
|
| index c3e9919e52a98548d957ef10a727e1fd812aafb8..da44f648d0b17595b21ad32830e5cb52b8b46048 100644
|
| --- a/include/private/SkMutex.h
|
| +++ b/include/private/SkMutex.h
|
| @@ -105,7 +105,21 @@ private:
|
| Lock* fMutex;
|
| };
|
|
|
| +// SkAutoTExclusive is a lighter weight version of SkAutoTAcquire. It assumes that there is a valid
|
| +// mutex, thus removing the check for the null pointer.
|
| +template <typename Lock>
|
| +class SkAutoTExclusive {
|
| +public:
|
| + SkAutoTExclusive(Lock& lock) : fLock(lock) { lock.acquire(); }
|
| + ~SkAutoTExclusive() { fLock.release(); }
|
| +private:
|
| + Lock &fLock;
|
| +};
|
| +
|
| typedef SkAutoTAcquire<SkBaseMutex> SkAutoMutexAcquire;
|
| #define SkAutoMutexAcquire(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexAcquire)
|
|
|
| +typedef SkAutoTExclusive<SkMutex> SkAutoMutexExclusive;
|
| +#define SkAutoMutexExclusive(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexExclusive)
|
| +
|
| #endif//SkMutex_DEFINED
|
|
|