-
-
Notifications
You must be signed in to change notification settings - Fork 564
Update race docs for new 3.5 semantics
#4526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: series/3.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -377,18 +377,16 @@ trait GenSpawn[F[_], E] extends MonadCancel[F, E] with Unique[F] { | |
|
|
||
| /** | ||
| * Races the evaluation of two fibers that returns the result of the winner, except in the | ||
| * case of cancelation. | ||
| * case of cancelation which cancels the whole race. | ||
| * | ||
| * The semantics of [[race]] are described by the following rules: | ||
| * | ||
| * 1. If the winner completes with [[Outcome.Succeeded]], the race returns the successful | ||
| * value. The loser is canceled before returning. 2. If the winner completes with | ||
| * [[Outcome.Errored]], the race raises the error. The loser is canceled before | ||
| * returning. 3. If the winner completes with [[Outcome.Canceled]], the race returns the | ||
| * result of the loser, consistent with the first two rules. 4. If both the winner and | ||
| * loser complete with [[Outcome.Canceled]], the race is canceled. 8. If the race is | ||
| * masked and is canceled because both participants canceled, the fiber will block | ||
| * indefinitely. | ||
| * returning. 3. If the winner completes with [[Outcome.Canceled]], the loser is canceled | ||
| * immediately but its outcome is returned if already completed. 4. If the race is masked | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a subtle point here: if the loser is cancelled, its In other words: "the loser is canceled immediately but its outcome is returned if already completed" <- I think this sentence suggests, that if the loser is not yet completed when it's cancelled, then its outcome will not be returned. This is not true. |
||
| * and is canceled because both participants canceled, the fiber will block indefinitely. | ||
| * | ||
| * @param fa | ||
| * the effect for the first racing fiber | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ambiguous: "in the case of cancelation" <- what does this mean? If the fiber executing
raceis canceled? If one or the other side cancels?