mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1233743 - Remove the Mutex typedef from gfx/2d. r=vlad
This commit is contained in:
parent
aa0d228da1
commit
f06dc39683
@ -79,7 +79,7 @@ bool
|
||||
MultiThreadedJobQueue::PopJob(Job*& aOutJobs, AccessType aAccess)
|
||||
{
|
||||
for (;;) {
|
||||
MutexAutoLock lock(&mMutex);
|
||||
CriticalSectionAutoEnter lock(&mMutex);
|
||||
|
||||
while (aAccess == BLOCKING && !mShuttingDown && mJobs.empty()) {
|
||||
mAvailableCondvar.Wait(&mMutex);
|
||||
@ -110,7 +110,7 @@ void
|
||||
MultiThreadedJobQueue::SubmitJob(Job* aJobs)
|
||||
{
|
||||
MOZ_ASSERT(aJobs);
|
||||
MutexAutoLock lock(&mMutex);
|
||||
CriticalSectionAutoEnter lock(&mMutex);
|
||||
mJobs.push_back(aJobs);
|
||||
mAvailableCondvar.Broadcast();
|
||||
}
|
||||
@ -118,21 +118,21 @@ MultiThreadedJobQueue::SubmitJob(Job* aJobs)
|
||||
size_t
|
||||
MultiThreadedJobQueue::NumJobs()
|
||||
{
|
||||
MutexAutoLock lock(&mMutex);
|
||||
CriticalSectionAutoEnter lock(&mMutex);
|
||||
return mJobs.size();
|
||||
}
|
||||
|
||||
bool
|
||||
MultiThreadedJobQueue::IsEmpty()
|
||||
{
|
||||
MutexAutoLock lock(&mMutex);
|
||||
CriticalSectionAutoEnter lock(&mMutex);
|
||||
return mJobs.empty();
|
||||
}
|
||||
|
||||
void
|
||||
MultiThreadedJobQueue::ShutDown()
|
||||
{
|
||||
MutexAutoLock lock(&mMutex);
|
||||
CriticalSectionAutoEnter lock(&mMutex);
|
||||
mShuttingDown = true;
|
||||
while (mThreadsCount) {
|
||||
mAvailableCondvar.Broadcast();
|
||||
@ -149,7 +149,7 @@ MultiThreadedJobQueue::RegisterThread()
|
||||
void
|
||||
MultiThreadedJobQueue::UnregisterThread()
|
||||
{
|
||||
MutexAutoLock lock(&mMutex);
|
||||
CriticalSectionAutoEnter lock(&mMutex);
|
||||
mThreadsCount -= 1;
|
||||
if (mThreadsCount == 0) {
|
||||
mShutdownCondvar.Broadcast();
|
||||
@ -166,14 +166,14 @@ EventObject::~EventObject()
|
||||
bool
|
||||
EventObject::Peak()
|
||||
{
|
||||
MutexAutoLock lock(&mMutex);
|
||||
CriticalSectionAutoEnter lock(&mMutex);
|
||||
return mIsSet;
|
||||
}
|
||||
|
||||
void
|
||||
EventObject::Set()
|
||||
{
|
||||
MutexAutoLock lock(&mMutex);
|
||||
CriticalSectionAutoEnter lock(&mMutex);
|
||||
if (!mIsSet) {
|
||||
mIsSet = true;
|
||||
mCond.Broadcast();
|
||||
@ -183,7 +183,7 @@ EventObject::Set()
|
||||
void
|
||||
EventObject::Wait()
|
||||
{
|
||||
MutexAutoLock lock(&mMutex);
|
||||
CriticalSectionAutoEnter lock(&mMutex);
|
||||
if (mIsSet) {
|
||||
return;
|
||||
}
|
||||
|
@ -26,9 +26,6 @@ class Job;
|
||||
class PosixCondVar;
|
||||
class WorkerThread;
|
||||
|
||||
typedef mozilla::gfx::CriticalSection Mutex;
|
||||
typedef mozilla::gfx::CriticalSectionAutoEnter MutexAutoLock;
|
||||
|
||||
// posix platforms only!
|
||||
class PosixCondVar {
|
||||
public:
|
||||
@ -42,7 +39,7 @@ public:
|
||||
MOZ_ASSERT(!err);
|
||||
}
|
||||
|
||||
void Wait(Mutex* aMutex) {
|
||||
void Wait(CriticalSection* aMutex) {
|
||||
DebugOnly<int> err = pthread_cond_wait(&mCond, &aMutex->mMutex);
|
||||
MOZ_ASSERT(!err);
|
||||
}
|
||||
@ -101,7 +98,7 @@ public:
|
||||
protected:
|
||||
|
||||
std::list<Job*> mJobs;
|
||||
Mutex mMutex;
|
||||
CriticalSection mMutex;
|
||||
PosixCondVar mAvailableCondvar;
|
||||
PosixCondVar mShutdownCondvar;
|
||||
int32_t mThreadsCount;
|
||||
@ -131,7 +128,7 @@ public:
|
||||
void Set();
|
||||
|
||||
protected:
|
||||
Mutex mMutex;
|
||||
CriticalSection mMutex;
|
||||
PosixCondVar mCond;
|
||||
bool mIsSet;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user