The most effective rule for avoiding … deadlocks is to apply a partial order to … mutexes M1, M2, each thread that ever locks … This rule completely avoids deadlocks involving only mutexes … [but, not if you use condition variables].
Google-1
Google-2
Copyright clearance needed for quotation.