From 7c3137b98b6875c372325ac8aa91603a5c0d56a6 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 12 May 2008 17:22:16 +0000 Subject: [PATCH] * reader_count was not incremented when a waiting reader was woken up. * Added comment clarifying the use of reader_count and writer_count. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25474 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/pthread/pthread_rwlock.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/system/libroot/posix/pthread/pthread_rwlock.cpp b/src/system/libroot/posix/pthread/pthread_rwlock.cpp index 26be6dff01..cffa855e6b 100644 --- a/src/system/libroot/posix/pthread/pthread_rwlock.cpp +++ b/src/system/libroot/posix/pthread/pthread_rwlock.cpp @@ -95,6 +95,9 @@ struct LocalRWLock { int32_t lock_count; int32_t reader_count; int32_t writer_count; + // Note, that reader_count and writer_count are not used the same way. + // writer_count includes the write lock owner as well as waiting + // writers. reader_count includes read lock owners only. WaiterList waiters; status_t Init() @@ -245,6 +248,7 @@ private: if (waiter->userThread->wait_status > 0) { waiter->userThread->wait_status = B_OK; readers[readerCount++] = waiter->thread; + reader_count++; } }