pthread rw lock wrapper