|
RE: Is enq(Node node) safe?: msg#00014java.jsr.166-concurrency
Sorry, I do not notice that. Then how about compareAndSetTail part of this enq method, then my test scenario does apply, doesn't it? -----Original Message----- From: Doug Lea [mailto:dl@xxxxxxxxxxxxx] Sent: Wednesday, February 09, 2005 3:36 PM To: Hu, Jinsong Cc: concurrency-interest@xxxxxxxxxxxxxxxxxxxx Subject: Re: [concurrency-interest] Is enq(Node node) safe? Hu, Jinsong wrote: > 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. No. compareAndSetHead(h) expands to a compareAndSet(null, h). Only the first thread can succeed in CAS'ing head to non-null. The other might spin for a while until the successful one wakes up, but since this is a race in one-time initialization code, the potential for an unbounded spin is not worth specially handling. (Preliminary versions of this class had some spin control here, but in testing even on big multiprocessors, it was found not to have any effect so was simplified away.) -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?, David Holmes |
| Previous by Thread: | Re: Is enq(Node node) safe?, Doug Lea |
| Next by Thread: | RE: Is enq(Node node) safe?, David Holmes |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |