Skip to content

Commit 4c16f6b

Browse files
committed
Fix to build without warnings on 5.2.0
OCaml 5.2.0 changes the typing of `while true` loops. See: - ocaml/ocaml#11805 - ocaml/ocaml#12295
1 parent 3bad774 commit 4c16f6b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/kcas_data/hashtbl.ml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ module Xt = struct
226226
done
227227
in
228228
try
229-
if must_be_done_in_this_tx then
229+
if must_be_done_in_this_tx then begin
230230
(* If the old buckets have already been accessed, we cannot perform
231231
rehashing outside of the transaction. In this case rehashing
232232
becomes linearithmic, O(n*log(n)), because that is the best that
@@ -238,14 +238,17 @@ module Xt = struct
238238
(* If state is modified outside our expensive tx would fail. *)
239239
if Loc.fenceless_get state != initial_state then Retry.invalid ();
240240
rehash_a_few_buckets ~xt
241-
done
242-
else
241+
done;
242+
r
243+
end
244+
else begin
243245
(* When possible, rehashing is performed cooperatively a few buckets
244246
at a time. This gives expected linear time, O(n). *)
245247
while true do
246248
Xt.commit { tx = rehash_a_few_buckets }
247249
done;
248-
r
250+
r
251+
end
249252
with Done -> r
250253
end
251254
| Snapshot { state; snapshot } -> begin

0 commit comments

Comments
 (0)