|
RE: Is enq(Node node) safe?: msg#00012java.jsr.166-concurrency
My original posting does not assume that both threads need to successfully compareAndSetHead at the same time, they do have orders, one at a time, the point is, the first succeeded thread was forced to sleep after it successfully compareAndSetHead, since the first thread already finished this, the second thread should not fail on compareAndSetHead. -----Original Message----- From: Doug Lea [mailto:dl@xxxxxxxxxxxxx] Sent: Wednesday, February 09, 2005 3:17 PM To: Luke Blanshard Cc: jhu@xxxxxxxx; concurrency-interest@xxxxxxxxxxxxxxxxxxxx Subject: Re: [concurrency-interest] 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> |
|---|---|---|
| Previous by Date: | Re: Is enq(Node node) safe?, Doug Lea |
|---|---|
| Next by Date: | Re: Is enq(Node node) safe?, Doug Lea |
| Previous by Thread: | Re: Is enq(Node node) safe?, Doug Lea |
| Next by Thread: | Re: Is enq(Node node) safe?, Doug Lea |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |