Skip to content

Commit 5575fa1

Browse files
committed
Tweak
1 parent b69dc72 commit 5575fa1

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/kcas/kcas.ml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,9 @@ let block loc before =
396396
if add_awaiter loc before t then
397397
match Trigger.await t with
398398
| None -> ()
399-
| Some (exn, bt) ->
399+
| Some exn_bt ->
400400
remove_awaiter Backoff.default loc before t;
401-
Printexc.raise_with_backtrace exn bt
401+
Printexc.raise_with_backtrace (fst exn_bt) (snd exn_bt)
402402

403403
let rec update_no_alloc backoff loc state f =
404404
(* Fenceless is safe as we have had a fence before if needed and there is a fence after. *)
@@ -888,37 +888,39 @@ module Xt = struct
888888
| None ->
889889
remove_awaiters t xt (T Leaf) root |> ignore;
890890
commit_reset_reuse backoff xt tx
891-
| Some (exn, bt) ->
891+
| Some exn_bt ->
892892
remove_awaiters t xt (T Leaf) root |> ignore;
893-
Printexc.raise_with_backtrace exn bt
893+
Printexc.raise_with_backtrace (fst exn_bt) (snd exn_bt)
894894
end
895895
| T (Node _) as stop ->
896896
remove_awaiters t xt stop root |> ignore;
897897
commit_once_reuse backoff xt tx
898898
end
899899
end
900900

901-
and commit_once_reuse backoff xt tx =
902-
check xt;
903-
commit_reuse (Backoff.once backoff) xt tx
904-
905-
and commit_reset_reuse backoff xt tx =
901+
and commit_once_reuse backoff (Xt xt_r as xt : _ t) tx =
902+
tree_as_ref xt := T Leaf;
903+
xt_r.validate_counter <- initial_validate_period;
904+
xt_r.post_commit <- Action.noop;
905+
let backoff = Backoff.once backoff in
906906
check xt;
907-
commit_reuse (Backoff.reset backoff) xt tx
907+
commit backoff xt tx
908908

909-
and commit_reuse backoff (Xt xt_r as xt : _ t) tx =
909+
and commit_reset_reuse backoff (Xt xt_r as xt : _ t) tx =
910910
tree_as_ref xt := T Leaf;
911911
xt_r.validate_counter <- initial_validate_period;
912912
xt_r.post_commit <- Action.noop;
913+
let backoff = Backoff.reset backoff in
914+
check xt;
913915
commit backoff xt tx
914916

915-
and commit_once_alloc backoff mode (Xt xt_r as xt : _ t) tx =
916-
check xt;
917-
let backoff = Backoff.once backoff in
917+
and commit_once_alloc backoff mode (Xt xt_r : _ t) tx =
918918
let rot = U Leaf in
919919
let validate_counter = initial_validate_period in
920920
let post_commit = Action.noop in
921921
let xt = Xt { xt_r with rot; mode; validate_counter; post_commit } in
922+
let backoff = Backoff.once backoff in
923+
check xt;
922924
commit backoff xt tx
923925

924926
let[@inline] commit ?(backoff = Backoff.default) ?(mode = `Obstruction_free)

0 commit comments

Comments
 (0)