@@ -91,7 +91,7 @@ public actual open class LockFreeLinkedListNode {
9191 // prev.next correction, which does not provide linearizable backwards iteration, but can be used to
9292 // resume forward iteration when current node was removed.
9393 public actual val prevNode: Node
94- get() = correctPrev(null ) ? : findPrevNonRemoved(_prev .value)
94+ get() = correctPrev() ? : findPrevNonRemoved(_prev .value)
9595
9696 private tailrec fun findPrevNonRemoved (current : Node ): Node {
9797 if (! current.isRemoved) return current
@@ -207,7 +207,7 @@ public actual open class LockFreeLinkedListNode {
207207 val removed = (next as Node ).removed()
208208 if (_next .compareAndSet(next, removed)) {
209209 // was removed successfully (linearized remove) -- fixup the list
210- next.correctPrev(null )
210+ next.correctPrev()
211211 return null
212212 }
213213 }
@@ -247,7 +247,7 @@ public actual open class LockFreeLinkedListNode {
247247 if (next._prev .compareAndSet(nextPrev, this )) {
248248 // This newly added node could have been removed, and the above CAS would have added it physically again.
249249 // Let us double-check for this situation and correct if needed
250- if (isRemoved) next.correctPrev(null )
250+ if (isRemoved) next.correctPrev()
251251 return
252252 }
253253 }
@@ -265,7 +265,7 @@ public actual open class LockFreeLinkedListNode {
265265 * remover of this node will ultimately call [correctPrev] on the next node and that will fix all
266266 * the links from this node, too.
267267 */
268- private tailrec fun correctPrev (op : OpDescriptor ? ): Node ? {
268+ private tailrec fun correctPrev (): Node ? {
269269 val oldPrev = _prev .value
270270 var prev: Node = oldPrev
271271 var last: Node ? = null // will be set so that last.next === prev
@@ -278,22 +278,21 @@ public actual open class LockFreeLinkedListNode {
278278 // otherwise need to update prev
279279 if (! this ._prev .compareAndSet(oldPrev, prev)) {
280280 // Note: retry from scratch on failure to update prev
281- return correctPrev(op )
281+ return correctPrev()
282282 }
283283 return prev // return the correct prev
284284 }
285285 // slow path when we need to help remove operations
286286 this .isRemoved -> return null // nothing to do, this node was removed, bail out asap to save time
287- prevNext == = op -> return prev // part of the same op -- don't recurse, didn't correct prev
288287 prevNext is OpDescriptor -> { // help & retry
289288 prevNext.perform(prev)
290- return correctPrev(op ) // retry from scratch
289+ return correctPrev() // retry from scratch
291290 }
292291 prevNext is Removed -> {
293292 if (last != = null ) {
294293 // newly added (prev) node is already removed, correct last.next around it
295294 if (! last._next .compareAndSet(prev, prevNext.ref)) {
296- return correctPrev(op ) // retry from scratch on failure to update next
295+ return correctPrev() // retry from scratch on failure to update next
297296 }
298297 prev = last
299298 last = null
0 commit comments