From 22ae196eede644bebb18f15af8b6ea21fcecb9fd Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Fri, 21 Nov 2025 10:18:18 -0500 Subject: [PATCH] Update `race` docs for new 3.5 semantics --- .../src/main/scala/cats/effect/kernel/GenSpawn.scala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kernel/shared/src/main/scala/cats/effect/kernel/GenSpawn.scala b/kernel/shared/src/main/scala/cats/effect/kernel/GenSpawn.scala index e77b284004..c4c0132195 100644 --- a/kernel/shared/src/main/scala/cats/effect/kernel/GenSpawn.scala +++ b/kernel/shared/src/main/scala/cats/effect/kernel/GenSpawn.scala @@ -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 + * and is canceled because both participants canceled, the fiber will block indefinitely. * * @param fa * the effect for the first racing fiber