You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asyncband.apache.org by "Colerar (via GitHub)" <gi...@apache.org> on 2026/09/13 13:59:56 UTC
[PR] feat: add task group [asyncband]
Colerar opened a new pull request, #308:
URL: https://github.com/apache/asyncband/pull/308
## Summary
This PR implements the first `TaskGroup` proposed in the issue discussion.
Issue: #272
The design rationale and alternatives are discussed in [this issue comment](https://github.com/apache/asyncband/issues/272#issuecomment-5636767531).
## Main API
```rust
let (mut group, registrar) = TaskGroup::new();
let first = tokio::spawn(registrar.track(worker_a()).unwrap());
let second = tokio::spawn(registrar.track(worker_b()).unwrap());
group.close();
while let Some(output) = group.join_next().await {
process(output);
}
first.await.unwrap();
second.await.unwrap();
```
## Scope of this PR
This version intentionally does not provide:
- cancellation or a cancellation token
- forced interruption or task abortion
- `try_join()`, `race()`, or `race_ok()` result policies
- bounded concurrency or output backpressure
- multiple result consumers
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org
Re: [PR] feat: add task group [asyncband]
Posted by "QwQBiG (via GitHub)" <gi...@apache.org>.
QwQBiG commented on PR #308:
URL: https://github.com/apache/asyncband/pull/308#issuecomment-5659551111
Tested `2d7df57` locally: `cargo x test`, `cargo x check`, and `cargo x miri` passed. :P
Two points:
- Rust 1.86 fails with E0658 on the let chains in `Registration::drop`. Could you use nested `if let` to preserve the declared MSRV?
- I confirmed that `wait()` can return before the completed future is dropped if its `Tracked` wrapper remains alive. Is that intentional? If so, documenting this boundary would help callers distinguish result completion from resource cleanup.
Sorry if I misunderstood, or if this was already explained and I missed it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org
Re: [PR] feat: add task group [asyncband]
Posted by "Colerar (via GitHub)" <gi...@apache.org>.
Colerar commented on PR #308:
URL: https://github.com/apache/asyncband/pull/308#issuecomment-5660142042
> Tested `2d7df57` locally: `cargo x test`, `cargo x check`, and `cargo x miri` passed. :P
>
> Two points:
>
> * Rust 1.86 fails with E0658 on the let chains in `Registration::drop`. Could you use nested `if let` to preserve the declared MSRV?
>
> * I confirmed that `wait()` can return before the completed future is dropped if its `Tracked` wrapper remains alive. Is that intentional? If so, documenting this boundary would help callers distinguish result completion from resource cleanup.
>
>
> Sorry if I misunderstood, or if this was already explained and I missed it.
Thanks for catching both issues!
- MSRV fixed.
- I agreed that `wait()` should also cover resource cleanup. This is consistent with similar APIs such as `tokio_util::TaskTracker`, which use wrapper destruction as the task-lifetime boundary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org
Re: [PR] feat: add task group [asyncband]
Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on PR #308:
URL: https://github.com/apache/asyncband/pull/308#issuecomment-5659573743
> Rust 1.86 fails with E0658 on the let chains in Registration::drop. Could you use nested if let to preserve the declared MSRV?
While I don't insist on MSRV and agree that we can always bump the MSRV when needed, we may do it in a separate PR and decide the next MSRV with certain reason.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org
Re: [PR] feat: add task group [asyncband]
Posted by "Colerar (via GitHub)" <gi...@apache.org>.
Colerar commented on PR #308:
URL: https://github.com/apache/asyncband/pull/308#issuecomment-5653738658
> This version intentionally does not provide:
> ……
>
> - try_join(), race(), or race_ok() result policies
I am not sure whether this is the right time to add `TaskGroup`. It may also make sense to wait until the cancellation token proposed in [#223](https://github.com/apache/asyncband/issues/223) is available.
That said, this PR contains my current implementation so that we can evaluate the API and how it should eventually compose with cancellation. :D
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org
Re: [PR] feat: add task group [asyncband]
Posted by "QwQBiG (via GitHub)" <gi...@apache.org>.
QwQBiG commented on PR #308:
URL: https://github.com/apache/asyncband/pull/308#issuecomment-5661778248
Thanks for addressing both points and adding the regression test! Keeping the registration active until `Tracked` is dropped makes sense to me.
Agreed that any MSRV bump should be handled in a separate PR with a clear rationale. :P
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org