You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a23aa7a
Browse filesBrowse the repository at this point in the historyBrowse files
Fix when_all and when_any completing twice under a racing stop request
The stop callbacks that when_all (since #1718) and exec::when_any (since
#2115) register on the receiver's stop token increment the count of
outstanding children, request stop, and then arrive. If the last child
arrives on another thread while such a callback is running, the count is
already zero, so the callback's arrival completes the operation a second
time. With inplace_stop_source the thread of the last child usually
spins forever in ~inplace_stop_callback instead, waiting for a callback
that the other thread has already destroyed.
The extra count only worked around inplace_stop_source not tolerating
its destruction from inside its own request_stop() (#1889), which #2303
fixed. Make both callbacks only forward the request to the internal stop
source, like on-stop-request in [exec.when.all]. For when_all this also
undoes the rest of the workaround from #1851: it completes with
set_stopped only when a child does, and it no longer records values once
a child has failed or been stopped.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
0 commit comments