I got one implementation of read/write locks which is below. Notice that in the beginning of the functions, there is a `pthread_mutex_lock` call. If it uses `pthread_mutex_lock` once anyway, then what is the benefit of using read/write locks. How is it better than simply using `pthread_mutex_lock`?

```
int pthread_rwlock_rlock_np(pthread_rwlock_t *rwlock)
{
    pthread_mutex_lock(&(rwlock->mutex));
    rwlock->r_waiting++;
    while (rwlock->r_wait > 0)
    {
        pthread_cond_wait(&(rwlock->r_ok), &(rwlock->mutex));
    }
    rwlock->reading++;
    rwlock->r_waiting--;
    pthread_mutex_unlock(&(rwlock->mutex));
    return 0;
}

int pthread_rwlock_wlock_np(pthread_rwlock_t *rwlock)
{
    pthread_mutex_lock(&(rwlock->mutex));
    if(pthread_mutex_trylock(&(rwlock->w_lock)) == 0)
    {
        rwlock->r_wait = 1;
        rwlock->w_waiting++;
        while (rwlock->reading > 0)
        {
            pthread_cond_wait(&(rwlock->w_ok), &(rwlock->mutex));
        }
        rwlock->w_waiting--;
        pthread_mutex_unlock(&(rwlock->mutex));
        return 0;
    }
    else
    {
        rwlock->wu_waiting++;
        while (pthread_mutex_trylock(&(rwlock->w_lock)) != 0)
        {
            pthread_cond_wait(&(rwlock->w_unlock), &(rwlock->mutex));
        }
        rwlock->wu_waiting--;
        rwlock->r_wait = 1;
        rwlock->w_waiting++;
        while (rwlock->reading > 0)
        {
            pthread_cond_wait(&(rwlock->w_ok), &(rwlock->mutex));
        }
        rwlock->w_waiting--;
        pthread_mutex_unlock(&(rwlock->mutex));
        return 0;
    }
}

```