mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
comments in ws_deque
This commit is contained in:
parent
530507d84e
commit
894851f6e8
1 changed files with 11 additions and 8 deletions
|
|
@ -109,14 +109,17 @@ let pop (self : 'a t) : 'a option =
|
||||||
let x = CA.get arr b in
|
let x = CA.get arr b in
|
||||||
perhaps_shrink self ~bottom:b ~top:t;
|
perhaps_shrink self ~bottom:b ~top:t;
|
||||||
Some x
|
Some x
|
||||||
) else if A.compare_and_set self.top t (t + 1) then (
|
) else (
|
||||||
(* exactly one slot, so we might be racing against stealers
|
assert (size = 0);
|
||||||
to update [self.top] *)
|
if A.compare_and_set self.top t (t + 1) then (
|
||||||
let x = CA.get arr b in
|
(* exactly one slot, so we might be racing against stealers
|
||||||
A.set self.bottom (t + 1);
|
to update [self.top] *)
|
||||||
Some x
|
let x = CA.get arr b in
|
||||||
) else
|
A.set self.bottom (t + 1);
|
||||||
None
|
Some x
|
||||||
|
) else
|
||||||
|
None
|
||||||
|
)
|
||||||
|
|
||||||
let steal (self : 'a t) : 'a option =
|
let steal (self : 'a t) : 'a option =
|
||||||
(* read [top], but do not update [top_cached]
|
(* read [top], but do not update [top_cached]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue