Replaced usage of List template class by the kernel utils Vector.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3811 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5b489f6f16
commit
2091bd588f
@ -435,8 +435,8 @@ RWLocker::_WriteLock(bigtime_t timeout)
|
||||
int32
|
||||
RWLocker::_AddReadLockInfo(ReadLockInfo* info)
|
||||
{
|
||||
int32 index = fReadLockInfos.CountItems();
|
||||
fReadLockInfos.AddItem(info, index);
|
||||
int32 index = fReadLockInfos.Count();
|
||||
fReadLockInfos.Insert(info, index);
|
||||
return index;
|
||||
}
|
||||
|
||||
@ -457,8 +457,9 @@ RWLocker::_NewReadLockInfo(thread_id thread, int32 count)
|
||||
void
|
||||
RWLocker::_DeleteReadLockInfo(int32 index)
|
||||
{
|
||||
if (ReadLockInfo* info = fReadLockInfos.ItemAt(index)) {
|
||||
fReadLockInfos.RemoveItem(index);
|
||||
if (index >= 0 && index < fReadLockInfos.Count()) {
|
||||
ReadLockInfo* info = fReadLockInfos.ElementAt(index);
|
||||
fReadLockInfos.Erase(index);
|
||||
delete info;
|
||||
}
|
||||
}
|
||||
@ -467,14 +468,16 @@ RWLocker::_DeleteReadLockInfo(int32 index)
|
||||
RWLocker::ReadLockInfo*
|
||||
RWLocker::_ReadLockInfoAt(int32 index) const
|
||||
{
|
||||
return fReadLockInfos.ItemAt(index);
|
||||
if (index >= 0 && index < fReadLockInfos.Count())
|
||||
return fReadLockInfos.ElementAt(index);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// _IndexOf
|
||||
int32
|
||||
RWLocker::_IndexOf(thread_id thread) const
|
||||
{
|
||||
int32 count = fReadLockInfos.CountItems();
|
||||
int32 count = fReadLockInfos.Count();
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
if (_ReadLockInfoAt(i)->reader == thread)
|
||||
return i;
|
||||
|
@ -70,7 +70,7 @@
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
#include "List.h"
|
||||
#include <Vector.h>
|
||||
|
||||
class RWLocker {
|
||||
public:
|
||||
@ -114,16 +114,18 @@ class RWLocker {
|
||||
static void _ReleaseBenaphore(Benaphore& benaphore);
|
||||
|
||||
private:
|
||||
mutable Benaphore fLock; // data lock
|
||||
Benaphore fMutex; // critical code mutex
|
||||
Benaphore fQueue; // queueing semaphore
|
||||
int32 fReaderCount; // total count...
|
||||
int32 fWriterCount; // total count...
|
||||
List<ReadLockInfo*> fReadLockInfos;
|
||||
thread_id fWriter; // current write lock owner
|
||||
int32 fWriterWriterCount; // write lock owner count
|
||||
int32 fWriterReaderCount; // writer read lock owner
|
||||
// count
|
||||
mutable Benaphore fLock; // data lock
|
||||
Benaphore fMutex; // critical code mutex
|
||||
Benaphore fQueue; // queueing semaphore
|
||||
int32 fReaderCount; // total count...
|
||||
int32 fWriterCount; // total count...
|
||||
Vector<ReadLockInfo*> fReadLockInfos;
|
||||
thread_id fWriter; // current write lock
|
||||
// owner
|
||||
int32 fWriterWriterCount; // write lock owner
|
||||
// count
|
||||
int32 fWriterReaderCount; // writer read lock
|
||||
// owner count
|
||||
};
|
||||
|
||||
#endif // RW_LOCKER_H
|
||||
|
Loading…
Reference in New Issue
Block a user