Hi all,
try to get a deadlock accessing via 2 threads 2 resources in synchronized blocks like:
synchronized(A){
synchronized(B){
}
}
and
synchronized(B){
synchronized(A){
}
}
i try to put the threads on sleep, use system.outs just to make sure my threads are accessing these objects in a convenient way, i know this because i got this output(copied/pasted from one run):
1. u tryin to acquire lock on A
2. u got lock on A, tryin to get lock on B
3. v tryin to acquire lock on B
4. v got lock on B, tryin to get lock on A
5. v got lock on A
6. v
thread, freed all locks
7. u got lock on B
... and so on..
so, my question, how's it possible to read the 5th line if the u thread has already the lock on A?
Thanks,
vali