The cancellation code checks for counter > 0 to detect if a waiter is still part of the wait_group's linked list. However, that is broken if non-zero -> zero -> non-zero transitions occur.
|
// Relaxed since non-zero -> zero transitions cannot happen while the mutex is held. |
|
if(wg_->ctr_.load(std::memory_order_relaxed) > 0) { |
|
cancelled = true; |
|
auto it = wg_->queue_.iterator_to(this); |
|
wg_->queue_.erase(it); |
|
} |
The cancellation code checks for counter > 0 to detect if a waiter is still part of the
wait_group's linked list. However, that is broken if non-zero -> zero -> non-zero transitions occur.libasync/include/async/wait-group.hpp
Lines 111 to 116 in 48dce66