Skip to content

Commit

Permalink
Optimize thread load balancing mechanism (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
scopys authored Dec 29, 2023
1 parent 30a148a commit 04f761e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Thread/TaskExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ TaskExecutor::Ptr TaskExecutorGetterImp::getExecutor() {
TaskExecutor::Ptr executor_min_load = _threads[thread_pos];
auto min_load = executor_min_load->load();

for (size_t i = 0; i < _threads.size(); ++i, ++thread_pos) {
for (size_t i = 0; i < _threads.size(); ++i) {
++thread_pos;
if (thread_pos >= _threads.size()) {
thread_pos = 0;
}
Expand Down

0 comments on commit 04f761e

Please sign in to comment.