To summarize, this implementation just looks at what the original value after after was, and uses the atomicity of compare_and_swap to only insert the new node when this value is what we expect (guaranteeing that we do not overwrite a value that was just inserted in the same place). If the compare returns false, old_next will become the value that was just inserted in the next iteration.
To summarize, this implementation just looks at what the original value after after was, and uses the atomicity of compare_and_swap to only insert the new node when this value is what we expect (guaranteeing that we do not overwrite a value that was just inserted in the same place). If the compare returns false, old_next will become the value that was just inserted in the next iteration.
This comment was marked helpful 0 times.