> >  /**
> > @@ -179,7 +226,7 @@ rte_rwlock_write_lock(rte_rwlock_t *rwl)
> >  static inline void
> >  rte_rwlock_write_unlock(rte_rwlock_t *rwl)
> >  {
> > -   __atomic_store_n(&rwl->cnt, 0, __ATOMIC_RELEASE);
> > +   __atomic_fetch_sub(&rwl->cnt, RTE_RWLOCK_WRITE,
> > __ATOMIC_RELEASE);  
> 
> Yes. This is correct, regardless if another writer thread is waiting or not. 
> (Reviewed for one writer thread using rte_rwlock_write_lock() and another 
> using rte_rwlock_write_trylock().)
> 

Was trying to stick to original logic.

After writer releases want both writer and reader to be able to get in equally.
This provide a measure of fairness (no preference) so writers can't starve 
readers either.

Reply via email to