for example--
Object obj = new Object();
then I lock one section with lock(obj)
and I lock in other section also lock(obj)
if one thread is in the first section, does that mean that the other section is also locked?
for example--
Object obj = new Object();
then I lock one section with lock(obj)
and I lock in other section also lock(obj)
if one thread is in the first section, does that mean that the other section is also locked?
Locking is done on an object, not on a section or location of the code. If one thread takes the lock in the first location, the second thread can't take it anywhere - neither in the same location and nor in any other location.