UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FQueuedThreadPool Class Referenceabstract

#include <QueuedThreadPool.h>

+ Inheritance diagram for FQueuedThreadPool:

Public Member Functions

virtual bool Create (uint32 InNumQueuedThreads, uint32 StackSize=(32 *1024), EThreadPriority ThreadPriority=TPri_Normal, const TCHAR *Name=TEXT("UnknownThreadPool"))=0
 
virtual bool CreateForkable (uint32 InNumQueuedThreads, uint32 StackSize=(32 *1024), EThreadPriority ThreadPriority=TPri_Normal, const TCHAR *Name=TEXT("UnknownThreadPool"))
 
virtual void Destroy ()=0
 
virtual void AddQueuedWork (IQueuedWork *InQueuedWork, EQueuedWorkPriority InQueuedWorkPriority=EQueuedWorkPriority::Normal)=0
 
virtual bool RetractQueuedWork (IQueuedWork *InQueuedWork)=0
 
virtual int32 GetNumThreads () const =0
 
CORE_API FQueuedThreadPool ()
 
virtual CORE_API ~FQueuedThreadPool ()
 

Static Public Member Functions

static CORE_API FQueuedThreadPoolAllocate ()
 

Static Public Attributes

static CORE_API uint32 OverrideStackSize = 0
 

Detailed Description

Interface for queued thread pools.

This interface is used by all queued thread pools. It used as a callback by FQueuedThreads and is used to queue asynchronous work for callers.

Constructor & Destructor Documentation

◆ FQueuedThreadPool()

FQueuedThreadPool::FQueuedThreadPool ( )
default

◆ ~FQueuedThreadPool()

FQueuedThreadPool::~FQueuedThreadPool ( )
virtualdefault

Member Function Documentation

◆ AddQueuedWork()

virtual void FQueuedThreadPool::AddQueuedWork ( IQueuedWork InQueuedWork,
EQueuedWorkPriority  InQueuedWorkPriority = EQueuedWorkPriority::Normal 
)
pure virtual

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

Implemented in FQueuedThreadPoolWrapper, FQueuedThreadPoolDynamicWrapper, and FQueuedThreadPoolBase.

◆ Allocate()

FQueuedThreadPool * FQueuedThreadPool::Allocate ( )
static

Allocates a thread pool

Returns
A new thread pool.

◆ Create()

virtual bool FQueuedThreadPool::Create ( uint32  InNumQueuedThreads,
uint32  StackSize = (32 *1024),
EThreadPriority  ThreadPriority = TPri_Normal,
const TCHAR Name = TEXT("UnknownThreadPool") 
)
pure virtual

Creates the thread pool with the specified number of threads

Parameters
InNumQueuedThreadsSpecifies the number of threads to use in the pool
StackSizeThe size of stack the threads in the pool need (32K default)
ThreadPrioritypriority of new pool thread
Nameoptional name for the pool to be used for instrumentation
Returns
Whether the pool creation was successful or not

Implemented in FQueuedLowLevelThreadPool, FQueuedThreadPoolBase, and FQueuedThreadPoolTaskGraphWrapper.

◆ CreateForkable()

virtual bool FQueuedThreadPool::CreateForkable ( uint32  InNumQueuedThreads,
uint32  StackSize = (32 * 1024),
EThreadPriority  ThreadPriority = TPri_Normal,
const TCHAR Name = TEXT("UnknownThreadPool") 
)
inlinevirtual

Creates the thread pool with the specified number of forkable threads (see FForkProcessHelper)

Currently only works after the process has been forked because GetSingleThreadInterface() isn't implemented for pooled threads

Parameters
InNumQueuedThreadsSpecifies the number of threads to use in the pool
StackSizeThe size of stack the threads in the pool need (32K default)
ThreadPrioritypriority of new pool thread
Nameoptional name for the pool to be used for instrumentation
Returns
Whether the pool creation was successful or not

Reimplemented in FQueuedThreadPoolBase.

◆ Destroy()

virtual void FQueuedThreadPool::Destroy ( )
pure virtual

Tells the pool to clean up all background threads

Implemented in FQueuedThreadPoolTaskGraphWrapper, FQueuedLowLevelThreadPool, and FQueuedThreadPoolBase.

◆ GetNumThreads()

virtual int32 FQueuedThreadPool::GetNumThreads ( ) const
pure virtual

Get the number of queued threads

Implemented in FQueuedThreadPoolBase, and FQueuedThreadPoolWrapper.

◆ RetractQueuedWork()

virtual bool FQueuedThreadPool::RetractQueuedWork ( IQueuedWork InQueuedWork)
pure virtual

Attempts to retract a previously queued task.

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

Implemented in FQueuedThreadPoolBase, and FQueuedThreadPoolWrapper.

Member Data Documentation

◆ OverrideStackSize

uint32 FQueuedThreadPool::OverrideStackSize = 0
static

Stack size for threads created for the thread pool. Can be overridden by other projects. If 0 means to use the value passed in the Create method.


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