No, that is not a sensible way to control access to critical sections. Suppose that code segment 1 locks m1, then code segment 2 locks m2. Now each code segment will be forced to wait at a locked mutex. They deadlock.