Revert "Remove harmful attempts to be helpful in pthread_mutex functions."

This reverts commit 53f15d0325feeaf7e58dc79fce4ddf55e0a64b7a.

Change-Id: I523387bf2d41b7e9c987c15f4fd8e04a31ed20ff