Avoid deadlocks in a multithreaded process

deadlockidiomsmultithreading

What are the best practices/idioms should someone follow in order to avoid deadlocks?