Skip to content

Commit ff9b565

Browse files
committed
..
1 parent a94119c commit ff9b565

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

source/executors/thread_pool_executor.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ namespace concurrencpp::details {
4444
const std::function<void(std::string_view thread_name)> m_thread_terminated_callback;
4545

4646
void balance_work();
47-
48-
bool wait_for_task(std::unique_lock<std::mutex>& lock);
4947
bool drain_queue_impl();
50-
bool drain_queue();
5148

5249
void work_loop();
5350

@@ -278,14 +275,12 @@ void thread_pool_worker::balance_work() {
278275
}
279276

280277
bool thread_pool_worker::drain_queue_impl() {
281-
auto aborted = false;
282-
283278
while (!m_private_queue.empty()) {
284279
balance_work();
285280

286281
if (m_atomic_abort.load(std::memory_order_relaxed)) {
287-
aborted = true;
288-
break;
282+
mark_worker_stale();
283+
return false;
289284
}
290285

291286
assert(!m_private_queue.empty());
@@ -294,11 +289,6 @@ bool thread_pool_worker::drain_queue_impl() {
294289
task();
295290
}
296291

297-
if (aborted) {
298-
mark_worker_stale();
299-
return false;
300-
}
301-
302292
return true;
303293
}
304294

0 commit comments

Comments
 (0)