facebookexperimental / facebookexperimental/libunifex

async_manual_reset_event::async_wait - uncancellable

Open
#442 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

Is there a philosophical reason that `async_wait` is uncancellable? It seems that it is something that can be supported by async_manual_reset_event, if there is a will and desire to do so :-) .

```c++
task evt_coro(async_manual_reset_event& evt) {
co_await async_wait(evt);
}

TEST_F(ExecutionTest, AsyncManualResetEvent) {
async_scope scope;
async_manual_reset_event evt;
for (int i = 0; i < 5; ++i)
scope.spawn(evt_coro(evt));
println("cancelling the scope");
sync_wait(scope.cleanup()); // <-- stuck forever
}
```
P.S.

And, if async_manual_reset_event::async_wait becomes cancellable, we will automatically gain propagation of cancellation into a nested async_scopes being awaited upon by `co_await scope.cleanup()` or `co_await scope.complete()`, since the underlying machinery powering them is async_manual_reset_event.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.