allow SkMutex* as an alternative arg to SkAutoMutexAcquire constructor
git-svn-id: http://skia.googlecode.com/svn/trunk@3754 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
d65ad1324c
commit
064e50d495
@ -31,24 +31,29 @@ public:
|
||||
|
||||
class SkAutoMutexAcquire : SkNoncopyable {
|
||||
public:
|
||||
explicit SkAutoMutexAcquire(SkBaseMutex& mutex) : fMutex(&mutex)
|
||||
{
|
||||
explicit SkAutoMutexAcquire(SkBaseMutex& mutex) : fMutex(&mutex) {
|
||||
SkASSERT(fMutex != NULL);
|
||||
mutex.acquire();
|
||||
}
|
||||
|
||||
SkAutoMutexAcquire(SkBaseMutex* mutex) : fMutex(mutex) {
|
||||
if (mutex) {
|
||||
mutex->acquire();
|
||||
}
|
||||
}
|
||||
|
||||
/** If the mutex has not been release, release it now.
|
||||
*/
|
||||
~SkAutoMutexAcquire()
|
||||
{
|
||||
if (fMutex)
|
||||
~SkAutoMutexAcquire() {
|
||||
if (fMutex) {
|
||||
fMutex->release();
|
||||
}
|
||||
}
|
||||
|
||||
/** If the mutex has not been release, release it now.
|
||||
*/
|
||||
void release()
|
||||
{
|
||||
if (fMutex)
|
||||
{
|
||||
void release() {
|
||||
if (fMutex) {
|
||||
fMutex->release();
|
||||
fMutex = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user