On Tue, 10 Nov 1998, John Keiser wrote:
> > From: Moses DeJong [mailto:[EMAIL PROTECTED]]
> >
> >
> > On Tue, 10 Nov 1998, John Keiser wrote:
> >
> > Native does not matter but synchronized sure does. If people are using
> > things like java.io.PrintStream (for System.out or something) and the
> > JDK versions are synchronized but the classpath versions are not, that
> > would be a big problem. Is that what you meant?
> >
>
> It absolutely does not matter. As long as the object is thread-safe, it
> doesn't matter where the keyword "synchronized" is.
>
> One example:
>
> public synchronized void doSomething() {
> // does something we want to make threadsafe
> // does something that doesn't matter for thread safety
> }
>
> We need the option to make it more efficient by doing something like this:
>
> public void doSomething() {
> synchronized(this) {
> // does something we want to make threadsafe
> }
> // does something that doesn't matter for thread safety
> }
>
> There are situations where I have done this. It makes the system more
> efficient because threads get access to resources more quickly.
I get what you mean now. As long as they are synchronized internally it
would not matter.
> Unless marking a method synchronized changes code compiled against it (and
> I'm pretty sure it doesn't), our implementation of the JDK will be
> functionally identical to the JDK and just as threadsafe even if we change
> the location of the synchronized keyword.
>
> --John Keiser
>
later
mo