[concurrency-interest] Re: When do you use wait/notify?

Larry Riedel larryr@saturn.sdsu.edu
25 Jan 2004 20:39:30 -0000

> > it seems to me there may be significant misapprehensions about
> > Java application developers, and if so I think correcting those
> > misapprehensions may have the most significant positive effect
> > on design of the JDK APIs,
> Sorry that this came across in the wrong way!  I used "application
> developers" as a shorthand for "people who will use the supplied
> implementations" and "infrastructure developers" for "people who will
> reimplement existing interfaces or create new ones". I probably should
> have used different terminology.

Assuming it is considered natural and proper for application developers
to be directly using all the JSR166 type operations as well as those in
java.lang.Thread and java.lang.Object, and of course the built-in Java
stuff like "synchronized", I think it would be great if the wait/notify
JavaDoc illustrated implementing wait/notify (et al) using the JSR166
APIs, calling attention to the idiosyncratic semantics of wait/notify,
such as that notify() requires the thread hold the lock of the object,
and wait() does not release the other locks held by the thread.  And
says in some euphemistic way that no sane person would have come up
with such perverse semantics, but now there are clean alternatives.