UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ThreadingBase.cpp File Reference
#include "HAL/ThreadingBase.h"
#include "UObject/NameTypes.h"
#include "Stats/Stats.h"
#include "Misc/CommandLine.h"
#include "Misc/CoreDelegates.h"
#include "Misc/CoreStats.h"
#include "Misc/EventPool.h"
#include "Misc/LazySingleton.h"
#include "Misc/Fork.h"
#include "Templates/Atomic.h"
#include "HAL/IConsoleManager.h"
#include "HAL/PlatformStackWalk.h"
#include "ProfilingDebugging/MiscTrace.h"
#include "Async/Fundamental/Scheduler.h"
#include "Tasks/Pipe.h"
#include "AutoRTFM.h"
#include <atomic>

Classes

class  FFakeThread
 
class  FQueuedThread
 
class  FQueuedThreadPoolBase
 
class  FForkableThread
 

Macros

#define IS_RUNNING_GAMETHREAD_ON_EXTERNAL_THREAD   0
 

Functions

 DEFINE_STAT (STAT_EventWaitWithId)
 
 DEFINE_STAT (STAT_EventTriggerWithId)
 
 DECLARE_DWORD_COUNTER_STAT (TEXT("ThreadPoolDummyCounter"), STAT_ThreadPoolDummyCounter, STATGROUP_ThreadPoolAsyncTasks)
 
CORE_API bool IsInGameThread ()
 
CORE_API bool IsInParallelGameThread ()
 
CORE_API bool IsInParallelLoadingThread ()
 
CORE_API bool IsInWorkerThread ()
 
CORE_API bool IsInSlateThread ()
 
CORE_API bool IsAudioThreadRunning ()
 
CORE_API bool IsInAudioThread ()
 
CORE_API bool IsInActualRenderingThread ()
 
CORE_API bool IsInRenderingThread ()
 
CORE_API bool IsInAnyRenderingThread ()
 
CORE_API bool IsInParallelRenderingThread ()
 
CORE_API bool IsRHIThreadRunning ()
 
CORE_API bool IsInRHIThread ()
 
CORE_API bool IsInParallelRHIThread ()
 
CORE_API bool IsInActualLoadingThread ()
 

Variables

FQueuedThreadPoolGThreadPool = nullptr
 
FQueuedThreadPoolGIOThreadPool = nullptr
 
FQueuedThreadPoolGBackgroundPriorityThreadPool = nullptr
 
CORE_API UE::Tasks::FPipe GAudioPipe { TEXT("AudioPipe") }
 
CORE_API std::atomic< boolGIsAudioThreadRunning { false }
 
CORE_API std::atomic< boolGIsAudioThreadSuspended { false }
 
CORE_API FRunnableThreadGRenderingThread = nullptr
 
CORE_API bool GIsRunningRHIInSeparateThread_InternalUseOnly = false
 
CORE_API bool GIsRunningRHIInDedicatedThread_InternalUseOnly = false
 
CORE_API bool GIsRunningRHIInTaskThread_InternalUseOnly = false
 
bool(* IsInAsyncLoadingThread )() = &IsInAsyncLoadingThreadCoreInternal
 

Macro Definition Documentation

◆ IS_RUNNING_GAMETHREAD_ON_EXTERNAL_THREAD

#define IS_RUNNING_GAMETHREAD_ON_EXTERNAL_THREAD   0

Function Documentation

◆ DECLARE_DWORD_COUNTER_STAT()

DECLARE_DWORD_COUNTER_STAT ( TEXT("ThreadPoolDummyCounter")  ,
STAT_ThreadPoolDummyCounter  ,
STATGROUP_ThreadPoolAsyncTasks   
)

◆ DEFINE_STAT() [1/2]

DEFINE_STAT ( STAT_EventTriggerWithId  )

◆ DEFINE_STAT() [2/2]

DEFINE_STAT ( STAT_EventWaitWithId  )

◆ IsAudioThreadRunning()

CORE_API bool IsAudioThreadRunning ( )

◆ IsInActualLoadingThread()

CORE_API bool IsInActualLoadingThread ( )
Returns
True only if called from the async loading thread if it's enabled.

◆ IsInActualRenderingThread()

CORE_API bool IsInActualRenderingThread ( )
Returns
True if called from the rendering thread.

◆ IsInAnyRenderingThread()

CORE_API bool IsInAnyRenderingThread ( )
Returns
True if called from any of the rendering thread. Can be called from any thread without asserting.

◆ IsInAudioThread()

CORE_API bool IsInAudioThread ( )
Returns
True if called from the audio thread, and not merely a thread calling audio functions.

◆ IsInGameThread()

CORE_API bool IsInGameThread ( )
Returns
True if called from the game thread.

◆ IsInParallelGameThread()

CORE_API bool IsInParallelGameThread ( )
Returns
True if called from the game thread in a parallel for.

◆ IsInParallelLoadingThread()

CORE_API bool IsInParallelLoadingThread ( )
Returns
True if called from a parallel loading thread task.

◆ IsInParallelRenderingThread()

CORE_API bool IsInParallelRenderingThread ( )
Returns
True if called from the rendering thread, or if called from ANY thread that isn't the game thread, except that during single threaded rendering the game thread is ok too.

◆ IsInParallelRHIThread()

CORE_API bool IsInParallelRHIThread ( )
Returns
True if called from a thread tagged as an RHI task.

◆ IsInRenderingThread()

CORE_API bool IsInRenderingThread ( )
Returns
True if called from the rendering thread, or if called from ANY thread during single threaded rendering

◆ IsInRHIThread()

CORE_API bool IsInRHIThread ( )
Returns
True if called from the RHI thread, or if called from ANY thread during single threaded rendering

◆ IsInSlateThread()

CORE_API bool IsInSlateThread ( )
Returns
True if called from the slate thread, and not merely a thread calling slate functions.

◆ IsInWorkerThread()

CORE_API bool IsInWorkerThread ( )
Returns
True if called from a worker thread.

◆ IsRHIThreadRunning()

CORE_API bool IsRHIThreadRunning ( )
Returns
True if RHI thread is running

Variable Documentation

◆ GAudioPipe

CORE_API UE::Tasks::FPipe GAudioPipe { TEXT("AudioPipe") }

◆ GBackgroundPriorityThreadPool

FQueuedThreadPool* GBackgroundPriorityThreadPool = nullptr

◆ GIOThreadPool

FQueuedThreadPool* GIOThreadPool = nullptr

◆ GIsAudioThreadRunning

CORE_API std::atomic<bool> GIsAudioThreadRunning { false }

◆ GIsAudioThreadSuspended

CORE_API std::atomic<bool> GIsAudioThreadSuspended { false }

◆ GIsRunningRHIInDedicatedThread_InternalUseOnly

CORE_API bool GIsRunningRHIInDedicatedThread_InternalUseOnly = false

◆ GIsRunningRHIInSeparateThread_InternalUseOnly

CORE_API bool GIsRunningRHIInSeparateThread_InternalUseOnly = false

◆ GIsRunningRHIInTaskThread_InternalUseOnly

CORE_API bool GIsRunningRHIInTaskThread_InternalUseOnly = false

◆ GRenderingThread

CORE_API FRunnableThread* GRenderingThread = nullptr

Thread used for rendering

◆ GThreadPool

FQueuedThreadPool* GThreadPool = nullptr

The global thread pool

◆ IsInAsyncLoadingThread

bool(* IsInAsyncLoadingThread) () ( ) = &IsInAsyncLoadingThreadCoreInternal
Returns
True if called from the async loading thread if it's enabled, otherwise if called from game thread while is async loading code.