First question here: it is a very short yet fundamental thing in Java that I don't know...
In the following case, is the run()
method somehow executed with the lock that somemethod()
did acquire?
public synchronized void somemethod() {
Thread t = new Thread( new Runnable() {
void run() {
... <-- is a lock held here ?
}
}
t.start();
...
(lengthy stuff performed here, keeping the lock held)
...
}