!7 sclass ProvokeDeadLock > DynPrintLog { transient Lock a = fairLock(); transient Lock b = fairLock(); JComponent visualize() { ret withCenteredButtons(super.visualize(), "Do the deadlock", rThread doIt); } void doIt { temp dm_tempDisableAllButtons(); print("Initiating deadlock... :-)\n"); Thread threadA = startThread("A", r { lock a; // cool new syntax! print("Thread A has lock A."); sleep1Second(); print("Thread A getting lock B."); lock b; print("Thread A successful!"); }); Thread threadB = startThread("B", r { lock b; print("Thread B has lock B."); sleep1Second(); print("Thread B getting lock A."); lock a; print("Thread B successful!"); }); joinThreads(threadA, threadB); setModuleName(print("Deadlock solved!")); } }