зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1222782 - TSan: data race netwerk/cache2/CacheIOThread.cpp:148 Target (race on mXPCOMThread), r=jseward
This commit is contained in:
Родитель
79d5d6cd4d
Коммит
a040388dea
|
@ -21,6 +21,7 @@ NS_IMPL_ISUPPORTS(CacheIOThread, nsIThreadObserver)
|
|||
CacheIOThread::CacheIOThread()
|
||||
: mMonitor("CacheIOThread")
|
||||
, mThread(nullptr)
|
||||
, mXPCOMThread(nullptr)
|
||||
, mLowestLevelWaiting(LAST_LEVEL)
|
||||
, mCurrentlyExecutingLevel(0)
|
||||
, mHasXPCOMEvents(false)
|
||||
|
@ -33,6 +34,11 @@ CacheIOThread::CacheIOThread()
|
|||
|
||||
CacheIOThread::~CacheIOThread()
|
||||
{
|
||||
if (mXPCOMThread) {
|
||||
nsIThread *thread = mXPCOMThread;
|
||||
thread->Release();
|
||||
}
|
||||
|
||||
sSelf = nullptr;
|
||||
#ifdef DEBUG
|
||||
for (uint32_t level = 0; level < LAST_LEVEL; ++level) {
|
||||
|
@ -182,7 +188,7 @@ void CacheIOThread::ThreadFunc()
|
|||
if (threadInternal)
|
||||
threadInternal->SetObserver(this);
|
||||
|
||||
mXPCOMThread.swap(xpcomThread);
|
||||
mXPCOMThread = xpcomThread.forget().take();
|
||||
|
||||
lock.NotifyAll();
|
||||
|
||||
|
@ -203,7 +209,8 @@ loopStart:
|
|||
bool processedEvent;
|
||||
nsresult rv;
|
||||
do {
|
||||
rv = mXPCOMThread->ProcessNextEvent(false, &processedEvent);
|
||||
nsIThread *thread = mXPCOMThread;
|
||||
rv = thread->ProcessNextEvent(false, &processedEvent);
|
||||
} while (NS_SUCCEEDED(rv) && processedEvent);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
|
||||
mozilla::Monitor mMonitor;
|
||||
PRThread* mThread;
|
||||
nsCOMPtr<nsIThread> mXPCOMThread;
|
||||
Atomic<nsIThread *> mXPCOMThread;
|
||||
Atomic<uint32_t, Relaxed> mLowestLevelWaiting;
|
||||
uint32_t mCurrentlyExecutingLevel;
|
||||
nsTArray<nsCOMPtr<nsIRunnable> > mEventQueue[LAST_LEVEL];
|
||||
|
|
Загрузка…
Ссылка в новой задаче