pthread: introduce default lock manager

Based on a patch by Luca Barbato