logo       

Re: Is enq(Node node) safe?: msg#00011

java.jsr.166-concurrency

Subject: Re: Is enq(Node node) safe?

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise