Revert "Simplify recursive pthread mutex" This reverts commit 5ffe2981b7d0547dd957a61ac6e1e3db829748d1. This reverts commit 4adb7677635b2c8d764767f6b484de1b26217f5d. Recursive mutexes are an XSI extension, so better not rely on them.