From fe96fc1d03fe324ead52b53c97d0a6749bbbd24e Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 29 Oct 2022 13:18:23 +0100 Subject: [PATCH] Warn about both operations succeeding in Fiber.first Closes #356. --- lib_eio/core/eio__core.mli | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_eio/core/eio__core.mli b/lib_eio/core/eio__core.mli index 6820f692d..e4aa27290 100644 --- a/lib_eio/core/eio__core.mli +++ b/lib_eio/core/eio__core.mli @@ -207,7 +207,11 @@ module Fiber : sig As with [both], [f] runs immediately and [g] is scheduled next, ahead of any other queued work. - If both fibers fail, {!Exn.combine} is used to combine the exceptions. *) + If both fibers fail, {!Exn.combine} is used to combine the exceptions. + + Warning: it is always possible that {i both} operations will succeed (and one result will be thrown away). + This is because there is a period of time after the first operation succeeds, + but before its fiber finishes, during which the other operation may also succeed. *) val any : (unit -> 'a) list -> 'a (** [any fs] is like [first], but for any number of fibers.