Skip to content

Commit

Permalink
Fix to build without warnings on 5.2.0
Browse files Browse the repository at this point in the history
OCaml 5.2.0 changes the typing of `while true` loops.

See:
- ocaml/ocaml#11805
- ocaml/ocaml#12295
  • Loading branch information
polytypic committed Sep 16, 2023
1 parent 3bad774 commit 4c16f6b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/kcas_data/hashtbl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ module Xt = struct
done
in
try
if must_be_done_in_this_tx then
if must_be_done_in_this_tx then begin
(* If the old buckets have already been accessed, we cannot perform
rehashing outside of the transaction. In this case rehashing
becomes linearithmic, O(n*log(n)), because that is the best that
Expand All @@ -238,14 +238,17 @@ module Xt = struct
(* If state is modified outside our expensive tx would fail. *)
if Loc.fenceless_get state != initial_state then Retry.invalid ();
rehash_a_few_buckets ~xt
done
else
done;
r
end
else begin
(* When possible, rehashing is performed cooperatively a few buckets
at a time. This gives expected linear time, O(n). *)
while true do
Xt.commit { tx = rehash_a_few_buckets }
done;
r
r
end
with Done -> r
end
| Snapshot { state; snapshot } -> begin
Expand Down

0 comments on commit 4c16f6b

Please sign in to comment.