Skip to content

Commit

Permalink
Replace List.(@) by List.rev_append as (@) is not tail rec.
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrm committed Nov 21, 2024
1 parent 4cc4ce4 commit c3cc626
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bounded_stack.ml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ let rec push_all_as : type r. 'a t -> Backoff.t -> 'a list -> r mono -> r =
if curr_len + len > t.capacity then
match mono with Bool -> false | Unit -> raise Full
else
let after = (curr_len + len, values @ prev_values) in
let after =
(curr_len + len, List.rev_append (List.rev values) prev_values)
in
if Atomic.compare_and_set t.head before after then
match mono with Bool -> true | Unit -> ()
else push_all_as t (Backoff.once backoff) values mono
Expand Down

0 comments on commit c3cc626

Please sign in to comment.