Skip to content

Commit

Permalink
Merge pull request #85 from ikbuibui/busy_set_once
Browse files Browse the repository at this point in the history
Excessive setting of atomic thread state to busy
  • Loading branch information
ikbuibui authored Jul 29, 2024
2 parents 94894e4 + 337406d commit 00a80e4
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 00a80e4

Please sign in to comment.