When you need to acquire more than one lock in the methods of your application, you must be very careful with the order in which you get control of your locks. A bad choice can lead to a deadlock situation.
In this recipe, you will implement an example of a deadlock situation, then learn how to solve it.