Code Review
Compare your solutions
If the order of resource locking cannot be controlled (A always locked before B in any process), you cannot guarantee there will be no deadlocks.
If the order of resource locking cannot be controlled (A always locked before B in any process), you cannot guarantee there will be no deadlocks.