Check if pthread_rwlock_t is available and use it if so.