Skip to content

Conversation

@carols10cents
Copy link
Member

Fairly substantial edits after tech review that I've been lax on incorporating, and also copyedit changes.

I've tried not to break links; if you're here because I have, I apologize.

Looks like I forgot to save a few; some have weirdnesses i don't care to
special case right now
@carols10cents carols10cents marked this pull request as ready for review October 19, 2025 01:13
@carols10cents carols10cents merged commit 121f07a into main Oct 19, 2025
6 checks passed
@carols10cents carols10cents deleted the ch17 branch October 19, 2025 01:13
@NeatNit
Copy link

NeatNit commented Oct 21, 2025

Hi,
I had just reached this chapter in the book and was confused about "fairness". Since the chapter is now reworked I don't know whether this confusion was addressed, so I figured I'd ask you directly here instead of opening an issue.

In Chapter 17.2 there is this paragraph (emphasis mine):

Now, you’ll see the exact same order every time, which is very different from what we saw with threads. That is because the trpl::join function is fair, meaning it checks each future equally often, alternating between them, and never lets one race ahead if the other is ready.

https://doc.rust-lang.org/book/ch17-02-concurrency-with-async.html#listing-17-8
Permalink to source (still there after this PR)

On the other hand, Chapter 17.3 used to say this (emphasis mine):

Notice that if you flip the order of the arguments to race, the order of the “started” messages changes, even though the fast future always completes first. That’s because the implementation of this particular race function is not fair. It always runs the futures passed in as arguments in the order in which they’re passed. Other implementations are fair and will randomly choose which future to poll first.

https://doc.rust-lang.org/book/ch17-03-more-futures.html#listing-17-21 (link won't show this paragraph after the changes of this PR are published)
Permalink to source (now gone in main branch)

The emphasized parts contradict each other. 17.2 implies that fair runners are deterministic, at least when it comes to the initial execution of futures. 17.3 states that fair runners are random in this regard.

Is this resolved now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants