This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pthread_rwlock and writers preference


Hi!
Some time ago I've reported a bug 13701 as there are posix tests in LTP
that are failing with glibc. Now after carefully reading the
corresponding specification I'm not sure whether it's really a glibc bug.

The pthread_rwlock_rdlock[1] says:

...
The calling thread acquires the read lock if a writer does not hold the
lock and there are no writers blocked on the lock.
...

While the pthread_rwlock_wrlock[2] says:

...
Implementations may favor writers over readers to avoid writer
starvation.
...

Now while the first suggests that writer precedence is mandatory the
seconds suggests that it's optional. Older version of the rdlock specs
is even more confusing [3]:

...
The calling thread acquires the read lock if a writer does not hold the
lock and there are no writers blocked on the lock. It is unspecified
whether the calling thread acquires the lock when a writer does not hold
the lock and there are writers waiting for the lock.
...

It seems to distinguis between 'blocked' and 'waiting' on the lock.


Can any of you help me intepret what the specs really says and what
should be tested?

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_wrlock.html
[3] http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_rwlock_rdlock.html

bug 13701: http://sourceware.org/bugzilla/show_bug.cgi?id=13701

-- 
Cyril Hrubis
chrubis@suse.cz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]