I have this code in Java:
public void doSomeThing() {
synchronized (this) {
doSomeThingElse();
}
}
public void doSome
The synchronized use in both case this so if the synchronized block in doSomeThing run, you allready have the lock so you can execute the doSomeThingElse method.
If your code is so simple, it is equivalent to :
public synchronized void doSomeThing() {
doSomeThingElse();
}
public synchronized void doSomeThingElse() {
// do something else
}