Repository navigation
Commit b4de0c7
committed
stdexec::when_all: Hang After Stop Request
std::execution::when_all forwards stop requests through to its children
via the exposition-only class on-stop-request, defined as follows (see
[exec.snd.general]):
struct on-stop-request {
inplace_stop_source& stop-src; // exposition only
void operator()() noexcept { stop-src.request_stop(); }
};
stdexec::when_all used to be conforming in this regard, however this
changed in 36a92fd. That commit not
only complicates the stop callback used by stdexec::when_all but also
causes the __stopped state to be reachable even when no child is capable
of sending a stopped completion signal. The change to std::execution::
when_all introduced by P3887 (see
712953b) depends on the __stopped state
being impossible unless a child sends a stopped completion signal. This
tension meant that 36a92fd caused
stdexec::when_all to not complete (thereby leading to hangs) when:
- No child potentially sent a stopped completion signal, and
- Stop was requested
712953b intended to include a unit test
preventing the above-described regression but due to a typo (corrected
in this commit) that unit test failed in this regard.
Note that 36a92fd is a misdiagnosis and
should eventually be reverted (along with this commit save the above-
mentioned unit test correction). The issue that
36a92fd aims to address has nothing to
do with stdexec::when_all and is instead caused by the fact that
stdexec::inplace_stop_source is not well-behaved when the lifetime of
the stop source ends during the dispatch of the final stop callback.
This issue should be fixed separately and this commit is only intended
to workaround the issue in the meantime.1 parent aae4d02 commit b4de0c7
2 files changed
Lines changed: 22 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
288 | 297 | | |
289 | 298 | | |
290 | 299 | | |
| |||
298 | 307 | | |
299 | 308 | | |
300 | 309 | | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | 310 | | |
309 | 311 | | |
310 | 312 | | |
| |||
489 | 491 | | |
490 | 492 | | |
491 | 493 | | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
501 | 503 | | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
509 | 507 | | |
510 | 508 | | |
511 | 509 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
| 407 | + | |
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| |||
0 commit comments