@@ -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
403403let 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. *)
@@ -860,19 +860,20 @@ module Xt = struct
860860 Action. run xt_r.post_commit result
861861 else begin
862862 (* We switch to [`Lock_free] as there was interference. *)
863- commit_once_alloc backoff `Lock_free xt tx
863+ xt_r.mode < - `Lock_free ;
864+ commit_once_alloc backoff xt tx
864865 end
865866 end
866867 else if
867868 a_cmp = status
868869 || finish xt root (if 0 < = status then After else Before )
869870 then Action. run xt_r.post_commit result
870- else commit_once_alloc backoff xt_r.mode xt tx
871+ else commit_once_alloc backoff xt tx
871872 | exception Exit ->
872873 (* Fenceless is safe as there was a fence before. *)
873874 if fenceless_get (root_as_atomic xt) == R After then
874875 Action. run xt_r.post_commit result
875- else commit_once_alloc backoff xt_r.mode xt tx
876+ else commit_once_alloc backoff xt tx
876877 end
877878 end
878879 | exception Retry. Invalid -> commit_once_reuse backoff xt tx
@@ -888,37 +889,39 @@ module Xt = struct
888889 | None ->
889890 remove_awaiters t xt (T Leaf ) root |> ignore;
890891 commit_reset_reuse backoff xt tx
891- | Some ( exn , bt ) ->
892+ | Some exn_bt ->
892893 remove_awaiters t xt (T Leaf ) root |> ignore;
893- Printexc. raise_with_backtrace exn bt
894+ Printexc. raise_with_backtrace (fst exn_bt) (snd exn_bt)
894895 end
895896 | T (Node _ ) as stop ->
896897 remove_awaiters t xt stop root |> ignore;
897898 commit_once_reuse backoff xt tx
898899 end
899900 end
900901
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 =
902+ and commit_once_reuse backoff (Xt xt_r as xt : _ t ) tx =
903+ tree_as_ref xt := T Leaf ;
904+ xt_r.validate_counter < - initial_validate_period;
905+ xt_r.post_commit < - Action. noop;
906+ let backoff = Backoff. once backoff in
906907 check xt;
907- commit_reuse ( Backoff. reset backoff) xt tx
908+ commit backoff xt tx
908909
909- and commit_reuse backoff (Xt xt_r as xt : _ t ) tx =
910+ and commit_reset_reuse backoff (Xt xt_r as xt : _ t ) tx =
910911 tree_as_ref xt := T Leaf ;
911912 xt_r.validate_counter < - initial_validate_period;
912913 xt_r.post_commit < - Action. noop;
914+ let backoff = Backoff. reset backoff in
915+ check xt;
913916 commit backoff xt tx
914917
915- and commit_once_alloc backoff mode (Xt xt_r as xt : _ t ) tx =
916- check xt;
917- let backoff = Backoff. once backoff in
918+ and commit_once_alloc backoff (Xt xt_r : _ t ) tx =
918919 let rot = U Leaf in
919920 let validate_counter = initial_validate_period in
920921 let post_commit = Action. noop in
921- let xt = Xt { xt_r with rot; mode; validate_counter; post_commit } in
922+ let xt = Xt { xt_r with rot; validate_counter; post_commit } in
923+ let backoff = Backoff. once backoff in
924+ check xt;
922925 commit backoff xt tx
923926
924927 let [@ inline] commit ?(backoff = Backoff. default) ?(mode = `Obstruction_free )
0 commit comments