small refactor
Some checks failed
github pages / Deploy doc (push) Has been cancelled
Build and Test / build (push) Has been cancelled
Build and Test / build-compat (push) Has been cancelled
Build and Test / format (push) Has been cancelled

This commit is contained in:
Simon Cruanes 2025-10-25 21:46:20 -04:00
parent a26503df0b
commit d957f7b54e
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 3 additions and 4 deletions

View file

@ -431,8 +431,7 @@ let await (self : 'a t) : 'a =
| exception C.Running -> | exception C.Running ->
let trigger = Trigger.create () in let trigger = Trigger.create () in
(* suspend until the future is resolved *) (* suspend until the future is resolved *)
if C.try_attach self trigger then if C.try_attach self trigger then Trigger.await_exn trigger;
Option.iter Exn_bt.raise @@ Trigger.await trigger;
(* un-suspended: we should have a result! *) (* un-suspended: we should have a result! *)
get_or_fail_exn self get_or_fail_exn self

View file

@ -64,7 +64,7 @@ module State_ = struct
done; done;
(* wait for the other computation to be done *) (* wait for the other computation to be done *)
if !must_await then Trigger.await trigger |> Option.iter Exn_bt.raise if !must_await then Trigger.await_exn trigger
| Right_solved _ | Both_solved _ -> assert false | Right_solved _ | Both_solved _ -> assert false
end end
@ -144,7 +144,7 @@ let for_ ?chunk_size n (f : int -> int -> unit) : unit =
i := !i + len_range i := !i + len_range
done; done;
Trigger.await trigger |> Option.iter Exn_bt.raise; Trigger.await_exn trigger;
Option.iter Exn_bt.raise @@ A.get failure; Option.iter Exn_bt.raise @@ A.get failure;
() ()
) )