зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1153370 - Rescope monitor. r=jww
We can do this now that we're not manually nulling out mRunningThread anymore.
This commit is contained in:
Родитель
b6e5b6793e
Коммит
3d89d1e8b9
|
@ -275,20 +275,14 @@ MediaTaskQueue::Runner::Run()
|
|||
// run in a loop here so that we don't hog the thread pool. This means we may
|
||||
// run on another thread next time, but we rely on the memory fences from
|
||||
// mQueueMonitor for thread safety of non-threadsafe tasks.
|
||||
{
|
||||
MonitorAutoLock mon(mQueue->mQueueMonitor);
|
||||
// Note: Hold the monitor *before* we dispatch, in case we context switch
|
||||
// to another thread pool in the queue immediately and take the lock in the
|
||||
// other thread; mRunningThread could be set to the new thread's value and
|
||||
// then incorrectly anulled below in that case.
|
||||
nsresult rv = mQueue->mPool->Dispatch(this, NS_DISPATCH_NORMAL);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Failed to dispatch, shutdown!
|
||||
MonitorAutoLock mon(mQueue->mQueueMonitor);
|
||||
mQueue->mIsRunning = false;
|
||||
mQueue->mIsShutdown = true;
|
||||
mon.NotifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче