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

This reverts commit 888e4577fc027fc3ad4cd6b2a248779377f15c4c.