Luke Blanshard wrote:
I think the premise that both threads can succeed in setting the head is
false. One will succeed, the other will fail. The compareAndSetHead
call uses an atomic compare-and-set instruction to set the head only if
it is currently null. (Actually, I'm just guessing here -- if I'm wrong
I'm sure someone will correct me.
Thanks! Yes, this is true. I should have said this in my last mail,
to make clear that the compensation code elsewhere only needs to
cover apparently-null vs non-null cases.
-Doug
|