Bug 969165 - Convert Atomic<T> where T != bool but is used as a bool over to Atomic<bool>, now that it's supported, in xpcom/. r=froydnj

--HG--
extra : rebase_source : 4b4e47e4246c3764f1b8d50a308b7a717c53a865
This commit is contained in:
Jeff Walden 2014-02-06 22:05:24 -08:00
parent 198e3a93c5
commit f66c97b3c4
4 changed files with 11 additions and 11 deletions

View File

@ -113,7 +113,7 @@ nsMemoryImpl::FlushMemory(const char16_t* aReason, bool aImmediate)
}
}
int32_t lastVal = sIsFlushing.exchange(1);
bool lastVal = sIsFlushing.exchange(true);
if (lastVal)
return NS_OK;
@ -166,7 +166,7 @@ nsMemoryImpl::RunFlushers(const char16_t* aReason)
}
}
sIsFlushing = 0;
sIsFlushing = false;
return NS_OK;
}
@ -182,7 +182,7 @@ nsMemoryImpl::FlushEvent::Run()
return NS_OK;
}
mozilla::Atomic<int32_t>
mozilla::Atomic<bool>
nsMemoryImpl::sIsFlushing;
PRIntervalTime

View File

@ -38,7 +38,7 @@ protected:
const char16_t* mReason;
};
static mozilla::Atomic<int32_t> sIsFlushing;
static mozilla::Atomic<bool> sIsFlushing;
static FlushEvent sFlushEvent;
static PRIntervalTime sLastFlushTime;
};

View File

@ -20,7 +20,7 @@ using namespace mozilla;
NS_IMPL_ISUPPORTS2(TimerThread, nsIRunnable, nsIObserver)
TimerThread::TimerThread() :
mInitInProgress(0),
mInitInProgress(false),
mInitialized(false),
mMonitor("TimerThread.mMonitor"),
mShutdown(false),
@ -84,7 +84,7 @@ nsresult TimerThread::Init()
return NS_OK;
}
if (mInitInProgress.exchange(1) == 0) {
if (mInitInProgress.exchange(true) == false) {
// We hold on to mThread to keep the thread alive.
nsresult rv = NS_NewThread(getter_AddRefs(mThread), this);
if (NS_FAILED(rv)) {

View File

@ -56,7 +56,7 @@ public:
private:
~TimerThread();
mozilla::Atomic<int32_t> mInitInProgress;
mozilla::Atomic<bool> mInitInProgress;
bool mInitialized;
// These two internal helper methods must be called while mLock is held.