Merge "Modify the code to avoid potential deadlocks."