!7 static Lock a = fairLock(); static Lock b = fairLock(); static int timeout = 10000; p-tt { centerHigherConsole(); startDeadlockDetector_noStop = true; startDeadlockDetector(); print("Initiating deadlock with timeout " + timeout + " ms... :-)\n"); thread "A" { lockOrFail(a, timeout); try { print("Thread A has lock A."); sleep1Second(); print("Thread A getting lock B."); lockOrFail(b, timeout); try { print("Thread A successful!"); } finally { b.unlock(); } } finally { a.unlock(); } } thread "B" { lockOrFail(b, timeout); try { print("Thread B has lock B."); sleep1Second(); print("Thread B getting lock A."); lockOrFail(a, timeout); try { print("Thread B successful!"); } finally { a.unlock(); } } finally { b.unlock(); } } sleepQuietly(); }