Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 875404c

Browse files
author
Tsung-Wei Huang
committed
updated workstealing (0 -> C-1) in wakeup strategy
1 parent b186a01 commit 875404c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

taskflow/executor/workstealing.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,12 +585,10 @@ void WorkStealingExecutor<Closure>::_explore_task(
585585
// wasteful thief
586586
else if(vtm != thief) {
587587
size_t C = _workers[vtm].mailbox.load(std::memory_order_acquire);
588-
if(C && _workers[vtm].mailbox.compare_exchange_strong(C, 0,
588+
if(C && _workers[vtm].mailbox.compare_exchange_strong(C, C-1,
589589
std::memory_order_seq_cst,
590590
std::memory_order_relaxed)) {
591-
for(size_t c=0; c<C; ++c) {
592-
_notifier.notify(false);
593-
}
591+
_notifier.notify(false);
594592
}
595593
}
596594
}

0 commit comments

Comments
 (0)