Repository navigation
team: with_team docs count participants and point repeated use at an owned Pool and Team (#149) - #150
Merged
Merged
Conversation
… and show an owned Pool and Team (#149) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Covers items 2 and 3 of #149. Item 1 (a pool of
width - 1threads) is left for a threadteam decision; see below.What changes
with_teamrustdoc examples now say "N participants: the calling thread and N-1 reserved workers" instead of "eight / four / two reserved members". Thewith_teamrustdoc also states the participant count in prose.with_teamrustdoc now say thatwith_teamis for a one-off call: every call builds a new pool, spawning its worker threads and joining them at the end. Code that runs parallel work repeatedly should own athreadteam::PoolandTeam, build them once, and lend aParfrom the team to each call. A short example shows this, compiled as a doctest in the rustdoc.with_team_has_width_participantspins the current width:with_team(width)giveswidthparticipants, andinto_team(4)on a pool of 3 threads gives 3.Why item 1 is not in this PR
In threadteam 0.1.3,
into_team(width)clampswidthtopool.width(), which is the number of worker threads, and the leader counts toward it. A pool ofwidth - 1threads still acceptsinto_team(width), but the team has onlywidth - 1participants (measured: 3 threads,into_team(4)→ size 3). Sothreads(width - 1)would narrow everywith_teamteam by one. Saving the idle worker needs a threadteam change to howPool::widthandinto_teamcount the leader. Until then, the pool keepswidththreads, and one worker sleeps.Verification
with_teamexamples.cargo docreports the same 4 unresolved links as onmain; none are new.Refs #149 (not closed: item 1 remains).
🤖 Generated with Claude Code