From 337406df4aa00e8e2c16e9c657c40193ab262b45 Mon Sep 17 00:00:00 2001 From: Tapish Date: Mon, 29 Jul 2024 13:18:12 +0200 Subject: [PATCH] find_free_worker already sets thread as busy, dont do it again --- redGrapes/scheduler/pool_scheduler.tpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/redGrapes/scheduler/pool_scheduler.tpp b/redGrapes/scheduler/pool_scheduler.tpp index 0dce91a7..012ee181 100644 --- a/redGrapes/scheduler/pool_scheduler.tpp +++ b/redGrapes/scheduler/pool_scheduler.tpp @@ -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