Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.lang.java.programmer > #4853
| Date | 2011-06-01 07:18 -0700 |
|---|---|
| From | Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Making one or more threads wait for another to produce a value or fail |
| References | <alpine.DEB.2.00.1105311443530.28134@urchin.earth.li> <HMGdndl85vc2annQnZ2dnUVZ_t2dnZ2d@posted.palinacquisition> <alpine.DEB.2.00.1105311622310.14714@urchin.earth.li> <LIudnSEjsK5AKHjQnZ2dnUVZ_oWdnZ2d@posted.palinacquisition> <q4GdndNuBPafX3jQnZ2dnUVZ_vGdnZ2d@earthlink.com> |
| Message-ID | <Et-dnbkVr7fI13vQnZ2dnUVZ_rGdnZ2d@posted.palinacquisition> (permalink) |
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. 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. The .NET equivalent (for example) has well-defined and reliable behavior: if your thread wakes up from waiting, you know it was on purpose. And guess what? Sure, sometimes it's nice to wrap the "low level primitives" in a helper class (or use a pre-existing one), but a lot of the time it's just as easy to go ahead and use those "low level primitives", because they do what you _want_ them to do. Pete
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