synchronized(someObject) {
code
}
|
Normal interpretation: once a thread enters the code, no other thread can enter until the first thread exits.
Stronger interpretation: once a thread enters the code, no other thread can enter any section of code that is synchronized using the same lock tag.
public synchronized void someMethod() {
body
}
|
Note that this is equivalent to:
public void someMethod() {
synchronized(this) {
body
}
}
|
© 1996-99 Marty Hall, 1999 Lawrence M. Brown