Bug 1686222: Ensure proper thread is woken up when a new task is posted. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D102324
This commit is contained in:
Bas Schouten 2021-01-19 17:15:57 +00:00
Родитель 03c0b5f0e4
Коммит f346ba1851
1 изменённых файлов: 3 добавлений и 2 удалений

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

@ -833,11 +833,11 @@ void TaskController::MaybeInterruptTask(Task* aTask) {
return;
}
EnsureMainThreadTasksScheduled();
if (aTask->IsMainThreadOnly()) {
mMayHaveMainThreadTask = true;
EnsureMainThreadTasksScheduled();
if (mCurrentTasksMT.empty()) {
return;
}
@ -855,6 +855,7 @@ void TaskController::MaybeInterruptTask(Task* aTask) {
Task* lowestPriorityTask = nullptr;
for (PoolThread& thread : mPoolThreads) {
if (!thread.mCurrentTask) {
mThreadPoolCV.Notify();
// There's a free thread, no need to interrupt anything.
return;
}