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:
Bobby Holley 2015-04-10 11:52:08 -07:00
Родитель b6e5b6793e
Коммит 3d89d1e8b9
1 изменённых файлов: 6 добавлений и 12 удалений

Просмотреть файл

@ -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;
}