UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FQueuedThreadPoolWrapper Class Reference

#include <QueuedThreadPoolWrapper.h>

+ Inheritance diagram for FQueuedThreadPoolWrapper:

Classes

class  FScheduledWork
 

Public Member Functions

CORE_API FQueuedThreadPoolWrapper (FQueuedThreadPool *InWrappedQueuedThreadPool, int32 InMaxConcurrency=-1, TFunction< EQueuedWorkPriority(EQueuedWorkPriority)> InPriorityMapper=DefaultQueuedWorkPriorityWrapper)
 
CORE_API ~FQueuedThreadPoolWrapper ()
 
CORE_API void Pause ()
 
CORE_API void Resume (int32 InNumQueuedWork=-1)
 
CORE_API void SetMaxConcurrency (int32 MaxConcurrency=-1)
 
CORE_API void AddQueuedWork (IQueuedWork *InQueuedWork, EQueuedWorkPriority InPriority=EQueuedWorkPriority::Normal) override
 
CORE_API bool RetractQueuedWork (IQueuedWork *InQueuedWork) override
 
CORE_API int32 GetNumThreads () const override
 
int32 GetCurrentConcurrency () const
 
- Public Member Functions inherited from FQueuedThreadPool
virtual bool CreateForkable (uint32 InNumQueuedThreads, uint32 StackSize=(32 *1024), EThreadPriority ThreadPriority=TPri_Normal, const TCHAR *Name=TEXT("UnknownThreadPool"))
 
CORE_API FQueuedThreadPool ()
 
virtual CORE_API ~FQueuedThreadPool ()
 

Protected Member Functions

virtual int32 GetMaxConcurrency () const
 
virtual void OnScheduled (const IQueuedWork *)
 
virtual void OnUnscheduled (const IQueuedWork *)
 
virtual FScheduledWorkAllocateScheduledWork ()
 

Protected Attributes

FCriticalSection Lock
 
FThreadPoolPriorityQueue QueuedWork
 

Additional Inherited Members

- Static Public Member Functions inherited from FQueuedThreadPool
static CORE_API FQueuedThreadPoolAllocate ()
 
- Static Public Attributes inherited from FQueuedThreadPool
static CORE_API uint32 OverrideStackSize = 0
 

Detailed Description

ThreadPool wrapper implementation allowing to schedule up to MaxConcurrency tasks at a time making sub-partitioning another thread-pool a breeze and allowing more fine-grained control over scheduling by effectively giving another set of priorities.

Constructor & Destructor Documentation

◆ FQueuedThreadPoolWrapper()

FQueuedThreadPoolWrapper::FQueuedThreadPoolWrapper ( FQueuedThreadPool InWrappedQueuedThreadPool,
int32  InMaxConcurrency = -1,
TFunction< EQueuedWorkPriority(EQueuedWorkPriority)>  InPriorityMapper = DefaultQueuedWorkPriorityWrapper 
)

InWrappedQueuedThreadPool Underlying thread pool to schedule task to. InMaxConcurrency Maximum number of concurrent tasks allowed, -1 will limit concurrency to number of threads available in the underlying thread pool. InPriorityMapper Thread-safe function used to map any priority from this Queue to the priority that should be used when scheduling the task on the underlying thread pool.

◆ ~FQueuedThreadPoolWrapper()

FQueuedThreadPoolWrapper::~FQueuedThreadPoolWrapper ( )

Member Function Documentation

◆ AddQueuedWork()

void FQueuedThreadPoolWrapper::AddQueuedWork ( IQueuedWork InQueuedWork,
EQueuedWorkPriority  InQueuedWorkPriority = EQueuedWorkPriority::Normal 
)
overridevirtual

Checks to see if there is a thread available to perform the task. If not, it queues the work for later. Otherwise it is immediately dispatched.

Parameters
InQueuedWorkThe work that needs to be done asynchronously
InQueuedWorkPriorityThe priority at which to process this task
See also
RetractQueuedWork

Implements FQueuedThreadPool.

◆ AllocateScheduledWork()

virtual FScheduledWork * FQueuedThreadPoolWrapper::AllocateScheduledWork ( )
inlineprotectedvirtual

◆ GetCurrentConcurrency()

int32 FQueuedThreadPoolWrapper::GetCurrentConcurrency ( ) const
inline

◆ GetMaxConcurrency()

virtual int32 FQueuedThreadPoolWrapper::GetMaxConcurrency ( ) const
inlineprotectedvirtual

◆ GetNumThreads()

int32 FQueuedThreadPoolWrapper::GetNumThreads ( ) const
overridevirtual

Get the number of queued threads

Implements FQueuedThreadPool.

◆ OnScheduled()

virtual void FQueuedThreadPoolWrapper::OnScheduled ( const IQueuedWork )
inlineprotectedvirtual

◆ OnUnscheduled()

virtual void FQueuedThreadPoolWrapper::OnUnscheduled ( const IQueuedWork )
inlineprotectedvirtual

◆ Pause()

void FQueuedThreadPoolWrapper::Pause ( )

Queued task are not scheduled against the wrapped thread-pool until resumed

◆ Resume()

void FQueuedThreadPoolWrapper::Resume ( int32  InNumQueuedWork = -1)

Resume a specified amount of queued work, or -1 to unpause.

◆ RetractQueuedWork()

bool FQueuedThreadPoolWrapper::RetractQueuedWork ( IQueuedWork InQueuedWork)
overridevirtual

Attempts to retract a previously queued task.

Parameters
InQueuedWorkThe work to try to retract
Returns
true if the work was retracted
See also
AddQueuedWork

Implements FQueuedThreadPool.

◆ SetMaxConcurrency()

void FQueuedThreadPoolWrapper::SetMaxConcurrency ( int32  MaxConcurrency = -1)

Dynamically adjust the maximum number of concurrent tasks, -1 for unlimited.

Member Data Documentation

◆ Lock

FCriticalSection FQueuedThreadPoolWrapper::Lock
protected

◆ QueuedWork

FThreadPoolPriorityQueue FQueuedThreadPoolWrapper::QueuedWork
protected

The documentation for this class was generated from the following files: