Skip to content

Commit

Permalink
find_free_worker already sets thread as busy, dont do it again
Browse files Browse the repository at this point in the history
  • Loading branch information
ikbuibui committed Jul 29, 2024
1 parent a75c587 commit 337406d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions redGrapes/scheduler/pool_scheduler.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ namespace redGrapes
worker_id = next_worker.fetch_add(1) % n_workers;
if(worker_id == *TaskFreeCtx::current_worker_id)
worker_id = next_worker.fetch_add(1) % n_workers;
m_worker_pool.get_worker_thread(worker_id).worker.ready_queue.push(&task);
}
else
{
m_worker_pool.get_worker_thread(worker_id).worker.ready_queue.push(&task);
m_worker_pool.get_worker_thread(worker_id).worker.wake();
}

m_worker_pool.get_worker_thread(worker_id).worker.ready_queue.push(&task);
m_worker_pool.set_worker_state(worker_id, dispatch::thread::WorkerState::BUSY);
m_worker_pool.get_worker_thread(worker_id).worker.wake();
}

/* Wakeup some worker or the main thread
Expand Down

0 comments on commit 337406d

Please sign in to comment.