pthread_rwlock and writers preference

Xiaoguang Wang wangxg.fnst@cn.fujitsu.com
Thu Apr 3 11:18:00 GMT 2014


Hi!

Cyril Hrubis once reported a bug about pthread_rwlock() posix tests in LTP:
https://sourceware.org/bugzilla/show_bug.cgi?id=13701

And there were some clarification requests for Austin Group about this issue.
see:

http://austingroupbugs.net/view.php?id=720
http://austingroupbugs.net/view.php?id=722

According to the discussion results, it seems that write locks should be implemented to
take precedence before the read locks. 

But actually in glibc, if a reader has owned the lock and a writers is waiting on the lock,
now if another reader tries to get this lock, it will succeed. This is not correct behavior
according to pthread_rwlock_rdlock()'s manpage.

Would anyone help to confirm whether is this a glibc bug or should be fixed? Thanks.

Regards,
Xiaoguang Wang



More information about the Libc-alpha mailing list