public void DoWork() { lock (First.Sync) { First.DoWork(); DeadlockSync.Signal(); DeadlockSync.Wait(); lock (Second.Sync) { Second.DoWork(); } } }