Skip to content

Commit bfdcb74

Browse files
committed
Optimize canceler to avoid allocations
1 parent d13a03a commit bfdcb74

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/picos/bootstrap.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ module Computation = struct
163163

164164
open struct
165165
let propagate _ from into =
166-
match canceled from with None -> () | Some exn_bt -> cancel into exn_bt
166+
match Atomic.get from with
167+
| Returned _ | Continue _ -> ()
168+
| Canceled _ as after ->
169+
try_terminate into after Backoff.default |> ignore
167170
end
168171

169172
let canceler ~from ~into = Trigger.from_action from into propagate

0 commit comments

Comments
 (0)