Skip to content

Conversation

@OxleyS
Copy link
Contributor

@OxleyS OxleyS commented Sep 5, 2025

Fixes: #7553

As discussed in the above issue, we have an implicit guarantee that a task ID is not reused until both the task finishes and its JoinHandle is joined on or dropped. User code requires this guarantee to do useful things with the ID, so this PR updates docs to make it more explicit.

I chose the wording "joined on" to cover cases outside of plain .await. In particular, joining a task via &mut JoinHandle (e.g. tokio::select!) counts for all intents and purposes, despite not strictly consuming the JoinHandle.

@github-actions github-actions bot added R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR labels Sep 5, 2025
@ADD-SP ADD-SP added T-docs Topic: documentation A-tokio Area: The main tokio crate M-task Module: tokio/task labels Sep 6, 2025
@ADD-SP ADD-SP removed R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR labels Sep 7, 2025
@ADD-SP ADD-SP changed the title docs: clarify task ID reuse guarantees task: clarify task ID reuse guarantees Sep 7, 2025
@OxleyS
Copy link
Contributor Author

OxleyS commented Sep 9, 2025

Thanks for the review comments, I'll start revising.

Edit: Oh no, Github added the loom labels again 😄 Is there a way I can avoid that?

@github-actions github-actions bot added R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR labels Sep 9, 2025
Copy link
Member

@ADD-SP ADD-SP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ADD-SP ADD-SP merged commit 7f455b2 into tokio-rs:master Sep 15, 2025
89 checks passed
@Darksonn Darksonn mentioned this pull request Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate M-task Module: tokio/task R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR T-docs Topic: documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify re-use guarantees around tokio::task::Id

3 participants