Closed fairy-of-9 closed 5 years ago
Succeeded
Thank you...!!
@jeehoonkang in this case, if ThreadA succeeded, the Y.next will be changed from Z to new of ThreadA, then threadB executes, but we still keep the condition Y.next.compare_and_set(Z, new). I am supposing that threadB will always fail because Y.next is now new-of-threadA, not Z anymore.
Is this correct?
@luulinh90s I forget the context of this.. I assume two threads concurrently try to insert a node, right? Then yes, if thread A succeeded in CAS, then thread B will not be able to succeed in CAS too.
Then in the case of insertion, we will not try again at all, right? Furthermore, in case of removal and insertion are performed at the same time, if Insertion-thread (thread trying to insert) detects Z is marked to remove, we also don't need to try again because at this time, Insertion will always fail, am I right?
Hi...
I don't know what the letters in the red square are. I'm sorry... I didn't concentrate in a lecture...
Thanks