Skip to contentSkip to conversation

Add the pthread_rwlock_rdlock() different point explanation between Linux and POSIX

PATCH New Zhang Xiliang 1 participant 1 message Jul 20, 2009 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add the pthread_rwlock_rdlock() different point explanation between Linux and POSIX

I tested the scheduler of rwlock in Linux, and found that when write lock is blocked (a read process has acquired read lock), the other read process can acquire read lock again.

A read process                       <--acquired read lock
  ->A write process                  <--block for the reading process unlock
    ->The other read process         <--it acquired read lock again
      ->The write process            <--block for the two reading process unlock

In pthread_rwlock_rdlock() manual, the other read process should be blocked when a write process blocked. Write locks shall take precedence over read locks by default.

The diffrent point between Linux and POSIX should be listed in linux-glibc man page.

---
 man3p/pthread_rwlock_rdlock.3p |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
man3p/pthread_rwlock_rdlock.3p +6 -0
index b63adbf..6e471d8 100644
@@ -77,6 +77,12 @@ If a signal is delivered to a thread waiting for a read-write lock
 for reading, upon return from the signal handler the thread
 resumes waiting for the read-write lock for reading as if it was not
 interrupted.
+.SH DIFFERENCE BETWEEN LINUX and POSIX
+.LP
+In linux, when the threads involved in the lock are executing with 
+the scheduling policies SCHED_FIFO or SCHED_RR, if a reader holds the 
+lock and writers of higher or equal priority are blocked on the lock, 
+the other readers also hold the lock by default.
 .SH RETURN VALUE
 .LP
 If successful, the \fIpthread_rwlock_rdlock\fP() function shall return

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html