* 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
This commit is contained in:
@@ -95,6 +95,9 @@ struct LocalRWLock {
|
|||||||
int32_t lock_count;
|
int32_t lock_count;
|
||||||
int32_t reader_count;
|
int32_t reader_count;
|
||||||
int32_t writer_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;
|
WaiterList waiters;
|
||||||
|
|
||||||
status_t Init()
|
status_t Init()
|
||||||
@@ -245,6 +248,7 @@ private:
|
|||||||
if (waiter->userThread->wait_status > 0) {
|
if (waiter->userThread->wait_status > 0) {
|
||||||
waiter->userThread->wait_status = B_OK;
|
waiter->userThread->wait_status = B_OK;
|
||||||
readers[readerCount++] = waiter->thread;
|
readers[readerCount++] = waiter->thread;
|
||||||
|
reader_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user