This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
rwlocks and priority issues
- From: Stefan Seefeld <seefeld at sympatico dot ca>
- To: libc-alpha at sources dot redhat dot com
- Cc: seefeld at sympatico dot ca
- Date: Wed, 16 Apr 2003 09:26:25 -0400
- Subject: rwlocks and priority issues
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