Commit dcb8a92
committed
demo::task supports async cancellation
with poll_context:
when stop_source.request_stop() calls poll_context::cancel(), the target
operation's io_base::cancel() is called inline. this calls
sender_awaiter::stop() which transitions from stop_state::stopping to
stopped. because request_stop() returns back to callback_t in
stop_state::stopped, complete_stopped() is called there
with uring_context:
uring_context::cancel() is asynchronous, so callback_t is still in
stop_state::stopping when request_stop() returns. run_one() eventually
sees the target operation complete with ECANCELED and calls
io_base::cancel(). when that calls sender_awaiter::stop(), the state is
still stop_state::stopping, so complete_stopped() never gets called
this causes beman.net.examples.client to exit before demo::scope gets
the stop signal from the 2 coroutines:
> ERROR: scope destroyed with live jobs: 2
to address this, callback_t now handles this async case by transitioning
back to stop_state::running after stop_source.request_stop() returns
Signed-off-by: Casey Bodley <cbodley@redhat.com>1 parent c87fea3 commit dcb8a92
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
| |||
0 commit comments