Skip to content

Commit

Permalink
After picking a task from the global queue, gotta break from the loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Mar 15, 2023
1 parent 1cf4e83 commit f0f9675
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Common/Thread/ThreadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,14 @@ static void WorkerThreadFunc(GlobalThreadContext *global, TaskThreadContext *thr

// We are processing one now, so mark that.
thread->queue_size++;
break;
} else if (thread->queue_size != 0) {
// Check the thread, as we prefer a HIGH thread task to a global NORMAL task.
std::unique_lock<std::mutex> lock(thread->mutex);
if (!thread->private_queue[p].empty()) {
task = thread->private_queue[p].front();
thread->private_queue[p].pop_front();
break;
}
}
}
Expand Down Expand Up @@ -198,9 +200,9 @@ static void WorkerThreadFunc(GlobalThreadContext *global, TaskThreadContext *thr
if (task) {
task->Run();
task->Release();

// Reduce the queue size once complete.
thread->queue_size--;
// _dbg_assert_(thread->queue_size == thread->private_queue[0].size() + thread->private_queue[1].size() + thread->private_queue[2].size());
}
}

Expand Down

0 comments on commit f0f9675

Please sign in to comment.