Skip to content

Commit 4bd1891

Browse files
committed
Minor performance tweaks
1 parent 43a4e21 commit 4bd1891

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/picos/picos.ocaml5.ml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,7 @@ module Computation = struct
380380

381381
let attach_canceler ~from ~into =
382382
let canceler = canceler ~from ~into in
383-
if try_attach from canceler then canceler
384-
else begin
385-
check from;
386-
error_returned ()
387-
end
383+
if try_attach from canceler then canceler else error_returned (check from)
388384

389385
(* END COMPUTATION BOOTSTRAP *)
390386

@@ -493,7 +489,7 @@ module Fiber = struct
493489
let success = Trigger.on_signal trigger x y resume in
494490
if success then success
495491
else begin
496-
Computation.detach computation trigger;
492+
Computation.unsafe_unsuspend computation Backoff.default |> ignore;
497493
false
498494
end
499495
else if Computation.is_canceled computation then begin
@@ -600,7 +596,7 @@ module Fiber = struct
600596
(* BEGIN FIBER COMMON *)
601597

602598
module Maybe = struct
603-
let[@inline never] not_a_fiber () = invalid_arg "not a fiber"
599+
let[@inline never] not_a_fiber _ = invalid_arg "not a fiber"
604600

605601
type t = T : [< `Nothing | `Fiber ] tdt -> t [@@unboxed]
606602

@@ -632,7 +628,7 @@ module Fiber = struct
632628
| T (Fiber _ as t) -> check t
633629

634630
let[@inline] to_fiber = function
635-
| T Nothing -> not_a_fiber ()
631+
| T Nothing as any -> not_a_fiber any
636632
| T (Fiber _ as t) -> t
637633
end
638634

0 commit comments

Comments
 (0)