Suppose I\'m executing a synchronized
block of code inside some thread and within the synchronized
block I call a method that spawns another thread to
There's nothing wrong about this code. Before the return statement in someOtherMethod()
, the code is running in the synchronized block of someMethod()
. After the new thread starts, it will block on the synchronized
statement inside the run()
method until it obtains a lock on lock_obj
(at the earliest, whenever someMethod()
exits its synchronized block).