mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
small refactor
This commit is contained in:
parent
a26503df0b
commit
d957f7b54e
2 changed files with 3 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
()
|
()
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue