Torque3D Documentation / _generateds / ThreadSafeFreeList

ThreadSafeFreeList

Engine/source/platform/threads/threadSafeFreeList.h

Freelist for re-using allocations in a concurrent setting.

More...

Protected Attributes

Protected Functions

T *&
getNext(T * ptr)

Public Functions

ThreadSafeFreeList(U32 numPreAlloc)

Create the freelist.

void *

Return memory for a new instance.

free(void * ptr)

Return the memory allocated to the given instance to the freelist.

Detailed Description

Freelist for re-using allocations in a concurrent setting.

note:

Make sure that there are no more allocations in use when the free list is destructed.

note:

Allocated instances come with a reference already counted on the instance.

Parameters:
T

Type of elements to allocate; must be derived from ThreadSafeRefCount and have at least define one additional pointer-sized field.

Protected Attributes

T * mFreeList 

Protected Functions

getNext(T * ptr)

Public Functions

ThreadSafeFreeList(U32 numPreAlloc)

Create the freelist.

Parameters:

numPreAlloc

Number of instances to pre-allocate.

~ThreadSafeFreeList()

alloc()

Return memory for a new instance.

dumpDebug()

free(void * ptr)

Return the memory allocated to the given instance to the freelist.