So why do we talk then about N locks on the same object?
In method A.m3(), Thread-1 performs 3 unlock actions on the A object and Thread-2 performs 2 unlock actions on the A object.
Output:
m1: Thread-1
m2: Thread-1
m3: Thread-1
m2: Thread-2
m3: Thread-2
Why is a boolean logic not good enough?
The first thread performs 3 lock actions, returns from m3, m2 and m1. Then the virtual machine can release the lock.
The second thread performs 2 lock actions, returns from m3 and m2. Then the virtual machine can release the lock.
[ July 08, 2003: Message edited by: Marlene Miller ]