Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.lang.java.programmer > #4860
| Date | 2011-06-01 09:01 -0700 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Making one or more threads wait for another to produce a value or fail |
| References | (1 earlier) <HMGdndl85vc2annQnZ2dnUVZ_t2dnZ2d@posted.palinacquisition> <alpine.DEB.2.00.1105311622310.14714@urchin.earth.li> <LIudnSEjsK5AKHjQnZ2dnUVZ_oWdnZ2d@posted.palinacquisition> <q4GdndNuBPafX3jQnZ2dnUVZ_vGdnZ2d@earthlink.com> <Et-dnbkVr7fI13vQnZ2dnUVZ_rGdnZ2d@posted.palinacquisition> |
| Message-ID | <_IadnUg5nPvK_3vQnZ2dnUVZ_q-dnZ2d@earthlink.com> (permalink) |
On 6/1/2011 7:18 AM, Peter Duniho wrote: > On 5/31/11 9:37 PM, Patricia Shanahan wrote: >> On 5/31/2011 8:45 PM, Peter Duniho wrote: .... >>> Spurious wakeup, yes (why people continue to tolerate that in >>> Java, I have no idea…plenty of other APIs with concurrency >>> support don't have that trouble). >> >> I don't continue to tolerate spurious wake-ups in Java. My view of >> wait and notify is that they are low level primitives that I used >> as long as they were all we had. Why not use e.g. CountDownLatch? > > That's certainly one way to look at it. But you are still > "tolerating" spurious wake-ups in the sense in which I wrote that. > Why should the language _force_ you to avoid what would otherwise be > perfectly good program statements? > > In a language like Java, there really shouldn't be any such thing as > "low level primitives", except those that are still useful and easy > to use. The entire programmer-available surface should be usable > as-is. Yes, it's great when the libraries offer an abstraction that > more closely fits ones needs, but for there to be statements in Java > that pretty much just _always_ need working-around through the use of > some helper class doesn't make sense to me. It would definitely have been better if java.util.concurrent had been available in release 1.1. Nobody would have been forced to use wait-notify. It might even have been better to treat wait-notify as com.sun package stuff. That would have avoided misleading people into using it directly, in preference to perfectly suitable and far more convenient java.util.concurrent features, but might have inhibited experimentation with alternative features at the next level up. > Spurious wake-ups offer no benefit to the user (i.e. the programmer) > and are a symptom of implementation detail bleeding through into the > higher-level language. It's a strange anomaly in what is otherwise > normally a very helpful and relatively simple (in a good way) > high-level language. I agree. That is one reason why I recommend ignoring wait-notify in favor of java.util.concurrent unless you are implementing something with special requirements that are not met by any of the existing java.util.concurrent classes. Patricia
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Making one or more threads wait for another to produce a value or fail Tom Anderson <twic@urchin.earth.li> - 2011-05-31 15:00 +0100
Re: Making one or more threads wait for another to produce a value or fail Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-05-31 07:14 -0700
Re: Making one or more threads wait for another to produce a value or fail Tom Anderson <twic@urchin.earth.li> - 2011-05-31 16:46 +0100
Re: Making one or more threads wait for another to produce a value or fail Deeyana <d.awlberg@hotmail.invalid> - 2011-05-31 19:23 +0000
Re: Making one or more threads wait for another to produce a value or fail Tom Anderson <twic@urchin.earth.li> - 2011-06-01 22:12 +0100
Re: Making one or more threads wait for another to produce a value or fail Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-05-31 20:45 -0700
Re: Making one or more threads wait for another to produce a value or fail Patricia Shanahan <pats@acm.org> - 2011-05-31 21:37 -0700
Re: Making one or more threads wait for another to produce a value or fail Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-06-01 07:18 -0700
Re: Making one or more threads wait for another to produce a value or fail Patricia Shanahan <pats@acm.org> - 2011-06-01 09:01 -0700
Re: Making one or more threads wait for another to produce a value or fail Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-01 16:40 +1200
Re: Making one or more threads wait for another to produce a value or fail "John B. Matthews" <nospam@nospam.invalid> - 2011-06-01 11:22 -0400
Re: Making one or more threads wait for another to produce a value or fail Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-02 10:15 +1200
Re: Making one or more threads wait for another to produce a value or fail "John B. Matthews" <nospam@nospam.invalid> - 2011-06-01 21:38 -0400
Re: Making one or more threads wait for another to produce a value or fail Tom Anderson <twic@urchin.earth.li> - 2011-06-01 22:07 +0100
Re: Making one or more threads wait for another to produce a value or fail Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-06-01 22:46 -0700
Re: Making one or more threads wait for another to produce a value or fail markspace <-@.> - 2011-05-31 08:26 -0700
Re: Making one or more threads wait for another to produce a value or fail Tom Anderson <twic@urchin.earth.li> - 2011-05-31 19:13 +0100
Re: Making one or more threads wait for another to produce a value or fail Patricia Shanahan <pats@acm.org> - 2011-05-31 09:06 -0700
Re: Making one or more threads wait for another to produce a value or fail Paul Cager <paul.cager@googlemail.com> - 2011-05-31 10:08 -0700
Re: Making one or more threads wait for another to produce a value or fail Patricia Shanahan <pats@acm.org> - 2011-05-31 10:39 -0700
Re: Making one or more threads wait for another to produce a value or fail Paul Cager <paul.cager@googlemail.com> - 2011-05-31 16:24 -0700
Re: Making one or more threads wait for another to produce a value or fail Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-01 12:33 +1200
Re: Making one or more threads wait for another to produce a value or fail "John B. Matthews" <nospam@nospam.invalid> - 2011-06-01 00:38 -0400
Re: Making one or more threads wait for another to produce a value or fail markspace <-@.> - 2011-06-02 14:10 -0700
Re: Making one or more threads wait for another to produce a value or fail markspace <-@.> - 2011-06-02 14:25 -0700
Re: Making one or more threads wait for another to produce a value or fail Patricia Shanahan <pats@acm.org> - 2011-06-02 14:43 -0700
csiph-web