File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -45,11 +45,12 @@ let pop { head; _ } =
4545 in
4646 loop ()
4747
48- let rec fix_tail tail old_tail new_tail =
49- if Atomic. compare_and_set tail old_tail new_tail then
50- match Atomic. get new_tail with
51- | Nil -> ()
52- | Next (_ , new_new_tail ) -> fix_tail tail new_tail new_new_tail
48+ let rec fix_tail tail new_tail =
49+ let old_tail = Atomic. get tail in
50+ if
51+ Atomic. get new_tail == Nil
52+ && not (Atomic. compare_and_set tail old_tail new_tail)
53+ then fix_tail tail new_tail
5354
5455let push { tail; _ } value =
5556 let rec find_tail_and_enq curr_end node =
@@ -62,10 +63,8 @@ let push { tail; _ } value =
6263 let newnode = Next (value, new_tail) in
6364 let old_tail = Atomic. get tail in
6465 find_tail_and_enq old_tail newnode;
65- if Atomic. compare_and_set tail old_tail new_tail then
66- match Atomic. get new_tail with
67- | Nil -> ()
68- | Next (_ , new_new_tail ) -> fix_tail tail new_tail new_new_tail
66+ if not (Atomic. compare_and_set tail old_tail new_tail) then
67+ fix_tail tail new_tail
6968
7069let clean_until { head; _ } f =
7170 let b = Backoff. create () in
You can’t perform that action at this time.
0 commit comments