UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FQueuedThread Class Reference
+ Inheritance diagram for FQueuedThread:

Public Member Functions

 FQueuedThread ()=default
 
virtual bool Create (class FQueuedThreadPoolBase *InPool, uint32 InStackSize=0, EThreadPriority ThreadPriority=TPri_Normal, const TCHAR *ThreadName=nullptr)
 
virtual bool CreateForkable (class FQueuedThreadPoolBase *InPool, uint32 InStackSize=0, EThreadPriority ThreadPriority=TPri_Normal, const TCHAR *ThreadName=nullptr)
 
bool KillThread ()
 
void DoWork (IQueuedWork *InQueuedWork)
 
- Public Member Functions inherited from FRunnable
virtual bool Init ()
 
virtual void Stop ()
 
virtual void Exit ()
 
virtual class FSingleThreadRunnableGetSingleThreadInterface ()
 
virtual ~FRunnable ()
 

Protected Member Functions

virtual uint32 Run () override
 
FString SetupForCreate (class FQueuedThreadPoolBase *InPool, const TCHAR *ThreadName)
 

Protected Attributes

FEventDoWorkEvent = nullptr
 
TAtomic< boolTimeToDie { false }
 
IQueuedWork *volatile QueuedWork = nullptr
 
class FQueuedThreadPoolBaseOwningThreadPool = nullptr
 
FRunnableThreadThread = nullptr
 

Detailed Description

This is the interface used for all poolable threads. The usage pattern for a poolable thread is different from a regular thread and this interface reflects that. Queued threads spend most of their life cycle idle, waiting for work to do. When signaled they perform a job and then return themselves to their owning pool via a callback and go back to an idle state.

Constructor & Destructor Documentation

◆ FQueuedThread()

FQueuedThread::FQueuedThread ( )
default

Default constructor

Member Function Documentation

◆ Create()

virtual bool FQueuedThread::Create ( class FQueuedThreadPoolBase InPool,
uint32  InStackSize = 0,
EThreadPriority  ThreadPriority = TPri_Normal,
const TCHAR ThreadName = nullptr 
)
inlinevirtual

Creates the thread with the specified stack size and creates the various events to be able to communicate with it.

Parameters
InPoolThe thread pool interface used to place this thread back into the pool of available threads when its work is done
InStackSizeThe size of the stack to create. 0 means use the current thread's stack size
ThreadPrioritypriority of new thread
Returns
True if the thread and all of its initialization was successful, false otherwise

◆ CreateForkable()

virtual bool FQueuedThread::CreateForkable ( class FQueuedThreadPoolBase InPool,
uint32  InStackSize = 0,
EThreadPriority  ThreadPriority = TPri_Normal,
const TCHAR ThreadName = nullptr 
)
inlinevirtual

Attempts to creates a forkable thread (see FForkProcessHelper) with the specified stack size and creates the various events to be able to communicate with it.

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

Parameters
InPoolThe thread pool interface used to place this thread back into the pool of available threads when its work is done
InStackSizeThe size of the stack to create. 0 means use the current thread's stack size
ThreadPrioritypriority of new thread
Returns
True if the thread and all of its initialization was successful, false otherwise

◆ DoWork()

void FQueuedThread::DoWork ( IQueuedWork InQueuedWork)
inline

Tells the thread there is work to be done. Upon completion, the thread is responsible for adding itself back into the available pool.

Parameters
InQueuedWorkThe queued work to perform

◆ KillThread()

bool FQueuedThread::KillThread ( )
inline

Tells the thread to exit. If the caller needs to know when the thread has exited, it should use the bShouldWait value and tell it how long to wait before deciding that it is deadlocked and needs to be destroyed. NOTE: having a thread forcibly destroyed can cause leaks in TLS, etc.

Returns
True if the thread exited graceful, false otherwise

◆ Run()

uint32 FQueuedThread::Run ( void  )
overrideprotectedvirtual

The real thread entry point. It waits for work events to be queued. Once an event is queued, it executes it and goes back to waiting.

Implements FRunnable.

◆ SetupForCreate()

FString FQueuedThread::SetupForCreate ( class FQueuedThreadPoolBase InPool,
const TCHAR ThreadName 
)
inlineprotected

Common code use by Create functions

Member Data Documentation

◆ DoWorkEvent

FEvent* FQueuedThread::DoWorkEvent = nullptr
protected

The event that tells the thread there is work to do.

◆ OwningThreadPool

class FQueuedThreadPoolBase* FQueuedThread::OwningThreadPool = nullptr
protected

The pool this thread belongs to.

◆ QueuedWork

IQueuedWork* volatile FQueuedThread::QueuedWork = nullptr
protected

The work this thread is doing.

◆ Thread

FRunnableThread* FQueuedThread::Thread = nullptr
protected

My Thread

◆ TimeToDie

TAtomic<bool> FQueuedThread::TimeToDie { false }
protected

If true, the thread should exit.


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