[1791] in java-interest

home help back first fref pref prev next nref lref last post

Re: Q: keyword - synchronized

daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Sun Sep 17 00:27:01 1995

Date: Sat, 16 Sep 1995 12:03:32 -0800 (PDT)
From: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
Reply-To: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
To: Christian Dreke <cd4v@server.cs.virginia.edu>
Cc: java-interest@java.Eng.Sun.COM



Hi Chris,

> I am a little fuzzy about the implications of 
> a method being of type synchronized. Does it just mean 
> that only one thread may be executing it at any one time ? 
> Could somebody explain it to me ?

It means that the object on which the method is invoked is
locked before you enter the method and unlocked when you
exit the method. This means that many threads can be executing
the same method, but on different objects. If two threads execute
a synchronized methods on the same object, one will block until
the other is done. This is also called data locking. Synchronized
methods lock the class.

Have fun,

	Arthur van Hoff
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post