rwlocks and priority issues

Stefan Seefeld seefeld@sympatico.ca
Wed Apr 16 13:23:00 GMT 2003


hi there,

I'm trying to familiarize myself with the posix_rwlock API
and I wrote a little test application to get started.
The application runs three threads, all three with a while
loop, acquiring the lock, waiting some time, and releasing it.

Two of these threads use pthread_rwlock_rdlock, the third
uses pthread_rwlock_wrlock.

 From the documentation I would expect the write lock to have
priority, i.e. to get the lock as soon as the currently helt
read locks are released.
However, in reality the writer lock *never* gets the lock,
the readers are served first.

Am I misinterpreting the semantics of rwlocks, or is this
a bug in the rwlock implementation ?

Thanks for any help,
		Stefan

PS: the behavior is identical with the 'old' and the 'new'
     threading library, as tested with RH 8 and RH 9



More information about the Libc-alpha mailing list