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
|
int32
|
||||||
RWLocker::_AddReadLockInfo(ReadLockInfo* info)
|
RWLocker::_AddReadLockInfo(ReadLockInfo* info)
|
||||||
{
|
{
|
||||||
int32 index = fReadLockInfos.CountItems();
|
int32 index = fReadLockInfos.Count();
|
||||||
fReadLockInfos.AddItem(info, index);
|
fReadLockInfos.Insert(info, index);
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,8 +457,9 @@ RWLocker::_NewReadLockInfo(thread_id thread, int32 count)
|
|||||||
void
|
void
|
||||||
RWLocker::_DeleteReadLockInfo(int32 index)
|
RWLocker::_DeleteReadLockInfo(int32 index)
|
||||||
{
|
{
|
||||||
if (ReadLockInfo* info = fReadLockInfos.ItemAt(index)) {
|
if (index >= 0 && index < fReadLockInfos.Count()) {
|
||||||
fReadLockInfos.RemoveItem(index);
|
ReadLockInfo* info = fReadLockInfos.ElementAt(index);
|
||||||
|
fReadLockInfos.Erase(index);
|
||||||
delete info;
|
delete info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -467,14 +468,16 @@ RWLocker::_DeleteReadLockInfo(int32 index)
|
|||||||
RWLocker::ReadLockInfo*
|
RWLocker::ReadLockInfo*
|
||||||
RWLocker::_ReadLockInfoAt(int32 index) const
|
RWLocker::_ReadLockInfoAt(int32 index) const
|
||||||
{
|
{
|
||||||
return fReadLockInfos.ItemAt(index);
|
if (index >= 0 && index < fReadLockInfos.Count())
|
||||||
|
return fReadLockInfos.ElementAt(index);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _IndexOf
|
// _IndexOf
|
||||||
int32
|
int32
|
||||||
RWLocker::_IndexOf(thread_id thread) const
|
RWLocker::_IndexOf(thread_id thread) const
|
||||||
{
|
{
|
||||||
int32 count = fReadLockInfos.CountItems();
|
int32 count = fReadLockInfos.Count();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
if (_ReadLockInfoAt(i)->reader == thread)
|
if (_ReadLockInfoAt(i)->reader == thread)
|
||||||
return i;
|
return i;
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include "List.h"
|
#include <Vector.h>
|
||||||
|
|
||||||
class RWLocker {
|
class RWLocker {
|
||||||
public:
|
public:
|
||||||
@ -119,11 +119,13 @@ class RWLocker {
|
|||||||
Benaphore fQueue; // queueing semaphore
|
Benaphore fQueue; // queueing semaphore
|
||||||
int32 fReaderCount; // total count...
|
int32 fReaderCount; // total count...
|
||||||
int32 fWriterCount; // total count...
|
int32 fWriterCount; // total count...
|
||||||
List<ReadLockInfo*> fReadLockInfos;
|
Vector<ReadLockInfo*> fReadLockInfos;
|
||||||
thread_id fWriter; // current write lock owner
|
thread_id fWriter; // current write lock
|
||||||
int32 fWriterWriterCount; // write lock owner count
|
// owner
|
||||||
int32 fWriterReaderCount; // writer read lock owner
|
int32 fWriterWriterCount; // write lock owner
|
||||||
// count
|
// count
|
||||||
|
int32 fWriterReaderCount; // writer read lock
|
||||||
|
// owner count
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RW_LOCKER_H
|
#endif // RW_LOCKER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user