pthread: implement pthread_rwlock functions

Most of them are trivial wrappers around our rwlock. Unfortunately, the
placement trick won't work and we will have to allocate the rwlock through the
lazy_indirect mechanism.

We also have to check if the lock is taken for write or read before unlocking,
because there is only one unlock function in the pthread family. Other than
that, it is the exact same as our pthread_mutex implementation - including the
missing attr handling =)

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>