pthread_mutex_lock (&p->mutex);
while (p->writers_writing || p->readers_reading)
pthread_cond_wait (&p->lock_free, &p->mutex);
pthread_mutex_lock (&p->mutex);
while (p->writers_writing || p->readers_reading)
pthread_cond_wait (&p->lock_free, &p->mutex);