5#include "Containers/Array.h"
6#include "Containers/Queue.h"
57 static ObjectType *
Alloc() {
return new ObjectType; }
68template<
typename ObjectType,
typename ObjectAllocator=TMediaPoolDefaultObjectAllocator<ObjectType>>
86 while (WaitReadyForReuse.Dequeue(
Object))
88 Object->ShutdownPoolable();
99 ObjectType* Acquire(
bool bAlloc =
true)
101 ObjectType* Result =
nullptr;
121 WaitReadyForReuse.Pop();
135 if (Result ==
nullptr &&
bAlloc)
137 Result = ObjectAllocatorInstance->Alloc();
144 Result->InitializePoolable();
166 if (
Object->IsReadyForReuse())
168 Object->ShutdownPoolable();
173 WaitReadyForReuse.Enqueue(
Object);
178 void Reserve(
uint32 NumObjects)
182 while (NumObjects < (
uint32)Pool.Num())
187 while (NumObjects > (
uint32)Pool.Num())
189 Pool.Push(ObjectAllocatorInstance->Alloc());
196 if (WaitReadyForReuse.IsEmpty())
205 while (WaitReadyForReuse.Peek(
Object))
207 if (!
Object->IsReadyForReuse())
212 Object->ShutdownPoolable();
214 WaitReadyForReuse.Pop();
269 : Storage(
MakeShareable(new TStorage(ObjectAllocatorInstance)))
298 return Storage->Acquire(
bAlloc);
346 return Storage->Num();
383 Storage->Reserve(NumObjects);
#define check(expr)
Definition AssertionMacros.h:314
SharedPointerInternals::TRawPtrProxy< ObjectType > MakeShareable(ObjectType *InObject)
Definition SharedPointer.h:1947
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
FRWLock Lock
Definition UnversionedPropertySerialization.cpp:921
Definition ScopeLock.h:141
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition SharedPointer.h:1295
Definition PointerIsConvertibleFromTo.h:60