From 5575fa15b9e85b9ef8fd2d9f41979ba9fda3166e Mon Sep 17 00:00:00 2001 From: Vesa Karvonen Date: Sun, 24 Nov 2024 14:11:58 +0200 Subject: [PATCH] Tweak --- src/kcas/kcas.ml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/kcas/kcas.ml b/src/kcas/kcas.ml index f8fb2051..9d6f101d 100644 --- a/src/kcas/kcas.ml +++ b/src/kcas/kcas.ml @@ -396,9 +396,9 @@ let block loc before = if add_awaiter loc before t then match Trigger.await t with | None -> () - | Some (exn, bt) -> + | Some exn_bt -> remove_awaiter Backoff.default loc before t; - Printexc.raise_with_backtrace exn bt + Printexc.raise_with_backtrace (fst exn_bt) (snd exn_bt) let rec update_no_alloc backoff loc state f = (* Fenceless is safe as we have had a fence before if needed and there is a fence after. *) @@ -888,9 +888,9 @@ module Xt = struct | None -> remove_awaiters t xt (T Leaf) root |> ignore; commit_reset_reuse backoff xt tx - | Some (exn, bt) -> + | Some exn_bt -> remove_awaiters t xt (T Leaf) root |> ignore; - Printexc.raise_with_backtrace exn bt + Printexc.raise_with_backtrace (fst exn_bt) (snd exn_bt) end | T (Node _) as stop -> remove_awaiters t xt stop root |> ignore; @@ -898,27 +898,29 @@ module Xt = struct end end - and commit_once_reuse backoff xt tx = - check xt; - commit_reuse (Backoff.once backoff) xt tx - - and commit_reset_reuse backoff xt tx = + and commit_once_reuse backoff (Xt xt_r as xt : _ t) tx = + tree_as_ref xt := T Leaf; + xt_r.validate_counter <- initial_validate_period; + xt_r.post_commit <- Action.noop; + let backoff = Backoff.once backoff in check xt; - commit_reuse (Backoff.reset backoff) xt tx + commit backoff xt tx - and commit_reuse backoff (Xt xt_r as xt : _ t) tx = + and commit_reset_reuse backoff (Xt xt_r as xt : _ t) tx = tree_as_ref xt := T Leaf; xt_r.validate_counter <- initial_validate_period; xt_r.post_commit <- Action.noop; + let backoff = Backoff.reset backoff in + check xt; commit backoff xt tx - and commit_once_alloc backoff mode (Xt xt_r as xt : _ t) tx = - check xt; - let backoff = Backoff.once backoff in + and commit_once_alloc backoff mode (Xt xt_r : _ t) tx = let rot = U Leaf in let validate_counter = initial_validate_period in let post_commit = Action.noop in let xt = Xt { xt_r with rot; mode; validate_counter; post_commit } in + let backoff = Backoff.once backoff in + check xt; commit backoff xt tx let[@inline] commit ?(backoff = Backoff.default) ?(mode = `Obstruction_free)