![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include <DS_ThreadsafeAllocatingQueue.h>
Inheritance diagram for DataStructures::ThreadsafeAllocatingQueue< structureType >:Public Member Functions | |
| structureType * | Allocate (const char *file, unsigned int line) |
| void | Clear (const char *file, unsigned int line) |
| void | Deallocate (structureType *s, const char *file, unsigned int line) |
| bool | IsEmpty (void) |
| structureType * | Pop (void) |
| structureType * | PopInaccurate (void) |
| void | Push (structureType *s) |
| void | SetPageSize (int size) |
Protected Attributes | |
| MemoryPool< structureType > | memoryPool |
| RakNet::SimpleMutex | memoryPoolMutex |
| Queue< structureType * > | queue |
| RakNet::SimpleMutex | queueMutex |
Definition at line 22 of file DS_ThreadsafeAllocatingQueue.h.
| structureType * DataStructures::ThreadsafeAllocatingQueue< structureType >::Allocate | ( | const char * | file, |
| unsigned int | line | ||
| ) |
Definition at line 83 of file DS_ThreadsafeAllocatingQueue.h.
References test::s.
{
structureType *s;
memoryPoolMutex.Lock();
s=memoryPool.Allocate(file, line);
memoryPoolMutex.Unlock();
// Call new operator, memoryPool doesn't do this
s = new ((void*)s) structureType;
return s;
}
| void DataStructures::ThreadsafeAllocatingQueue< structureType >::Clear | ( | const char * | file, |
| unsigned int | line | ||
| ) |
Definition at line 104 of file DS_ThreadsafeAllocatingQueue.h.
{
memoryPoolMutex.Lock();
for (unsigned int i=0; i < queue.Size(); i++)
{
queue[i]->~structureType();
memoryPool.Release(queue[i], file, line);
}
queue.Clear(file, line);
memoryPoolMutex.Unlock();
memoryPoolMutex.Lock();
memoryPool.Clear(file, line);
memoryPoolMutex.Unlock();
}
| void DataStructures::ThreadsafeAllocatingQueue< structureType >::Deallocate | ( | structureType * | s, |
| const char * | file, | ||
| unsigned int | line | ||
| ) |
Definition at line 94 of file DS_ThreadsafeAllocatingQueue.h.
{
// Call delete operator, memory pool doesn't do this
s->~structureType();
memoryPoolMutex.Lock();
memoryPool.Release(s, file, line);
memoryPoolMutex.Unlock();
}
| bool DataStructures::ThreadsafeAllocatingQueue< structureType >::IsEmpty | ( | void | ) |
Definition at line 126 of file DS_ThreadsafeAllocatingQueue.h.
{
bool isEmpty;
queueMutex.Lock();
isEmpty=queue.IsEmpty();
queueMutex.Unlock();
return isEmpty;
}
| structureType * DataStructures::ThreadsafeAllocatingQueue< structureType >::Pop | ( | void | ) |
Definition at line 68 of file DS_ThreadsafeAllocatingQueue.h.
References test::s.
{
structureType *s;
queueMutex.Lock();
if (queue.IsEmpty())
{
queueMutex.Unlock();
return 0;
}
s=queue.Pop();
queueMutex.Unlock();
return s;
}
| structureType * DataStructures::ThreadsafeAllocatingQueue< structureType >::PopInaccurate | ( | void | ) |
Definition at line 53 of file DS_ThreadsafeAllocatingQueue.h.
References test::s.
{
structureType *s;
if (queue.IsEmpty())
return 0;
queueMutex.Lock();
if (queue.IsEmpty()==false)
s=queue.Pop();
else
s=0;
queueMutex.Unlock();
return s;
}
| void DataStructures::ThreadsafeAllocatingQueue< structureType >::Push | ( | structureType * | s | ) |
Definition at line 45 of file DS_ThreadsafeAllocatingQueue.h.
References _FILE_AND_LINE_.
{
queueMutex.Lock();
queue.Push(s, _FILE_AND_LINE_ );
queueMutex.Unlock();
}
| void DataStructures::ThreadsafeAllocatingQueue< structureType >::SetPageSize | ( | int | size | ) |
Definition at line 120 of file DS_ThreadsafeAllocatingQueue.h.
{
memoryPool.SetPageSize(size);
}
MemoryPool<structureType> DataStructures::ThreadsafeAllocatingQueue< structureType >::memoryPool [protected] |
Definition at line 38 of file DS_ThreadsafeAllocatingQueue.h.
RakNet::SimpleMutex DataStructures::ThreadsafeAllocatingQueue< structureType >::memoryPoolMutex [protected] |
Definition at line 39 of file DS_ThreadsafeAllocatingQueue.h.
Queue<structureType*> DataStructures::ThreadsafeAllocatingQueue< structureType >::queue [protected] |
Definition at line 40 of file DS_ThreadsafeAllocatingQueue.h.
RakNet::SimpleMutex DataStructures::ThreadsafeAllocatingQueue< structureType >::queueMutex [protected] |
Definition at line 41 of file DS_ThreadsafeAllocatingQueue.h.
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.