Bug 1067744 - Make GMPMutex reentrant. r=jesup

This commit is contained in:
Chris Pearce 2014-09-16 20:15:14 +12:00
parent 958564b8ca
commit 4eaaed125c
3 changed files with 6 additions and 4 deletions

View File

@ -257,7 +257,7 @@ GMPThreadImpl::Join()
}
GMPMutexImpl::GMPMutexImpl()
: mMutex("gmp-mutex")
: mMonitor("gmp-mutex")
{
MOZ_COUNT_CTOR(GMPMutexImpl);
}
@ -276,13 +276,13 @@ GMPMutexImpl::Destroy()
void
GMPMutexImpl::Acquire()
{
mMutex.Lock();
mMonitor.Lock();
}
void
GMPMutexImpl::Release()
{
mMutex.Unlock();
mMonitor.Unlock();
}
} // namespace gmp

View File

@ -46,7 +46,7 @@ public:
virtual void Destroy() MOZ_OVERRIDE;
private:
Mutex mMutex;
Monitor mMonitor;
};
} // namespace gmp

View File

@ -53,6 +53,8 @@ public:
virtual void Join() = 0; // Deletes object after join completes.
};
// A re-entrant monitor; can be locked from the same thread multiple times.
// Must be unlocked the same number of times it's locked.
class GMPMutex {
public:
virtual ~GMPMutex() {}