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

This reverts commit 6c2c790a2a7c36a1745be187c3b89f10a2e5b5c4.