pthread: implement reader/writer lock

[WIP]