comments in ws_deque

This commit is contained in:
Simon Cruanes 2023-10-25 22:32:42 -04:00
parent 530507d84e
commit 894851f6e8
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -109,14 +109,17 @@ let pop (self : 'a t) : 'a option =
let x = CA.get arr b in
perhaps_shrink self ~bottom:b ~top:t;
Some x
) else if A.compare_and_set self.top t (t + 1) then (
(* exactly one slot, so we might be racing against stealers
to update [self.top] *)
let x = CA.get arr b in
A.set self.bottom (t + 1);
Some x
) else
None
) else (
assert (size = 0);
if A.compare_and_set self.top t (t + 1) then (
(* exactly one slot, so we might be racing against stealers
to update [self.top] *)
let x = CA.get arr b in
A.set self.bottom (t + 1);
Some x
) else
None
)
let steal (self : 'a t) : 'a option =
(* read [top], but do not update [top_cached]