Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Haim committed Apr 21, 2024
1 parent a94119c commit ff9b565
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions source/executors/thread_pool_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ namespace concurrencpp::details {
const std::function<void(std::string_view thread_name)> m_thread_terminated_callback;

void balance_work();

bool wait_for_task(std::unique_lock<std::mutex>& lock);
bool drain_queue_impl();
bool drain_queue();

void work_loop();

Expand Down Expand Up @@ -278,14 +275,12 @@ void thread_pool_worker::balance_work() {
}

bool thread_pool_worker::drain_queue_impl() {
auto aborted = false;

while (!m_private_queue.empty()) {
balance_work();

if (m_atomic_abort.load(std::memory_order_relaxed)) {
aborted = true;
break;
mark_worker_stale();
return false;
}

assert(!m_private_queue.empty());
Expand All @@ -294,11 +289,6 @@ bool thread_pool_worker::drain_queue_impl() {
task();
}

if (aborted) {
mark_worker_stale();
return false;
}

return true;
}

Expand Down

0 comments on commit ff9b565

Please sign in to comment.