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

Public Member Functions

 FAsyncLoadingThread2 (FIoDispatcher &IoDispatcher)
 
virtual ~FAsyncLoadingThread2 ()
 
virtual ELoaderType GetLoaderType () const override
 
virtual bool Init () override
 
virtual uint32 Run () override
 
virtual void Stop () override
 
virtual void StartThread () override
 
virtual bool IsMultithreaded () override
 
void EnterAsyncLoadingTick ()
 
void LeaveAsyncLoadingTick ()
 
bool GetIsInAsyncLoadingTick () const
 
virtual bool IsAsyncLoadingPackages () override
 
virtual bool IsInAsyncLoadThread () override
 
virtual bool IsAsyncLoadingSuspended () override
 
virtual void NotifyConstructedDuringAsyncLoading (UObject *Object, bool bSubObjectThatAlreadyExists) override
 
virtual void NotifyUnreachableObjects (const TArrayView< FUObjectItem * > &UnreachableObjects) override
 
virtual void NotifyRegistrationEvent (FName PackageName, FName Name, ENotifyRegistrationType NotifyRegistrationType, ENotifyRegistrationPhase NotifyRegistrationPhase, UObject *(*InRegister)(), bool InbDynamic, UObject *FinishedObject) override
 
virtual void NotifyScriptVersePackage (Verse::VPackage *Package) override
 Called for built in packages (currently only VVMIntrinsics.cpp) to allow them to be imported.
 
void NotifyCompiledVersePackage (Verse::VPackage *Package)
 
virtual void NotifyRegistrationComplete () override
 
FORCEINLINE FAsyncPackage2FindAsyncPackage (FPackageId PackageId)
 
FORCEINLINE FAsyncPackage2GetAsyncPackage (const FPackageId &PackageId)
 
void UpdatePackagePriority (FAsyncLoadingThreadState2 &ThreadState, FAsyncPackage2 *Package)
 
void UpdatePackagePriorityRecursive (FAsyncLoadingThreadState2 &ThreadState, FAsyncPackage2 *Package, int32 NewPriority)
 
FAsyncPackage2FindOrInsertPackage (FAsyncLoadingThreadState2 &ThreadState, FAsyncPackageDesc2 &InDesc, bool &bInserted, FAsyncPackage2 *ImportedByPackage, TUniquePtr< FLoadPackageAsyncDelegate > &&PackageLoadedDelegate=TUniquePtr< FLoadPackageAsyncDelegate >(), TSharedPtr< FLoadPackageAsyncProgressDelegate > PackageProgressDelegate=nullptr)
 
void QueueUnresolvedPackage (FAsyncLoadingThreadState2 &ThreadState, EPackageStoreEntryStatus PackageStatus, FAsyncPackageDesc2 &PackageDesc, TUniquePtr< FLoadPackageAsyncDelegate > &&LoadPackageAsyncDelegate, TSharedPtr< FLoadPackageAsyncProgressDelegate > LoadPackageAsyncProgressDelegate)
 
EAsyncPackageState::Type ProcessAsyncLoadingFromGameThread (FAsyncLoadingThreadState2 &ThreadState, bool &bDidSomething)
 
EAsyncPackageState::Type TickAsyncLoadingFromGameThread (FAsyncLoadingThreadState2 &ThreadState, bool bUseTimeLimit, bool bUseFullTimeLimit, double TimeLimit, TConstArrayView< int32 > FlushRequestIDs, bool &bDidSomething)
 
EAsyncPackageState::Type TickAsyncThreadFromGameThread (FAsyncLoadingThreadState2 &ThreadState, bool &bDidSomething)
 
virtual void InitializeLoading () override
 
virtual void ShutdownLoading () override
 
virtual bool ShouldAlwaysLoadPackageAsync (const FPackagePath &PackagePath) override
 
int32 LoadPackageInternal (const FPackagePath &InPackagePath, FName InCustomName, TUniquePtr< FLoadPackageAsyncDelegate > &&InCompletionDelegate, TSharedPtr< FLoadPackageAsyncProgressDelegate > InProgressDelegate, EPackageFlags InPackageFlags, int32 InPIEInstanceID, int32 InPackagePriority, const FLinkerInstancingContext *InInstancingContext, uint32 InLoadFlags)
 
virtual int32 LoadPackage (const FPackagePath &InPackagePath, FName InCustomName, FLoadPackageAsyncDelegate InCompletionDelegate, EPackageFlags InPackageFlags, int32 InPIEInstanceID, int32 InPackagePriority, const FLinkerInstancingContext *InstancingContext=nullptr, uint32 InLoadFlags=LOAD_None) override
 
virtual int32 LoadPackage (const FPackagePath &InPackagePath, FLoadPackageAsyncOptionalParams Params) override
 
EAsyncPackageState::Type ProcessLoadingFromGameThread (FAsyncLoadingThreadState2 &ThreadState, bool bUseTimeLimit, bool bUseFullTimeLimit, double TimeLimit)
 
virtual EAsyncPackageState::Type ProcessLoading (bool bUseTimeLimit, bool bUseFullTimeLimit, double TimeLimit) override
 
EAsyncPackageState::Type ProcessLoadingUntilCompleteFromGameThread (FAsyncLoadingThreadState2 &ThreadState, TFunctionRef< bool()> CompletionPredicate, double TimeLimit)
 
virtual EAsyncPackageState::Type ProcessLoadingUntilComplete (TFunctionRef< bool()> CompletionPredicate, double TimeLimit) override
 
virtual void CancelLoading () override
 
virtual void SuspendLoading () override
 
virtual void ResumeLoading () override
 
virtual void FlushLoading (TConstArrayView< int32 > RequestIds) override
 
void FlushLoadingFromLoadingThread (FAsyncLoadingThreadState2 &ThreadState, TConstArrayView< int32 > RequestIds)
 
void FlushLoadingFromParallelLoadingThread (FAsyncLoadingThreadState2 &ThreadState, TConstArrayView< int32 > RequestIds)
 
void WarnAboutPotentialSyncLoadStall (FAsyncLoadingSyncLoadContext *SyncLoadContext)
 
virtual int32 GetNumQueuedPackages () override
 
virtual int32 GetNumAsyncPackages () override
 
virtual float GetAsyncLoadPercentage (const FName &PackageName) override
 
bool ContainsRequestID (int32 RequestID)
 
bool ContainsAnyPendingRequests ()
 
bool ContainsAnyRequestID (TConstArrayView< int32 > RequestIDs)
 
void AddPendingRequest (int32 RequestID)
 
void RemovePendingRequests (FAsyncLoadingThreadState2 &ThreadState, TConstArrayView< int32 > RequestIDs)
 
void AddPendingCDOs (FAsyncPackage2 *Package, TArray< UClass *, TInlineAllocator< 8 > > &Classes)
 
bool ProcessDeferredDeletePackagesQueue (int32 MaxCount=MAX_int32)
 
- Public Member Functions inherited from FRunnable
virtual void Exit ()
 
virtual class FSingleThreadRunnableGetSingleThreadInterface ()
 
virtual ~FRunnable ()
 
- Public Member Functions inherited from IAsyncPackageLoader
virtual ~IAsyncPackageLoader ()
 

Public Attributes

FZenaphore AltZenaphore
 
FAsyncLoadEventGraphAllocator GraphAllocator
 
FAsyncLoadEventQueue2 EventQueue
 
FAsyncLoadEventQueue2 MainThreadEventQueue
 
TArray< FAsyncLoadEventSpecEventSpecs
 

Friends

struct FAsyncPackage2
 
class FAsyncLoadingVerseRoot
 

Additional Inherited Members

- Static Protected Member Functions inherited from IAsyncPackageLoader
static int32 GetNextRequestId ()
 

Constructor & Destructor Documentation

◆ FAsyncLoadingThread2()

FAsyncLoadingThread2::FAsyncLoadingThread2 ( FIoDispatcher IoDispatcher)

◆ ~FAsyncLoadingThread2()

FAsyncLoadingThread2::~FAsyncLoadingThread2 ( )
virtual

Member Function Documentation

◆ AddPendingCDOs()

void FAsyncLoadingThread2::AddPendingCDOs ( FAsyncPackage2 Package,
TArray< UClass *, TInlineAllocator< 8 > > &  Classes 
)
inline

◆ AddPendingRequest()

void FAsyncLoadingThread2::AddPendingRequest ( int32  RequestID)
inline

[ASYNC/GAME THREAD] Adds a request ID to the list of pending requests

◆ CancelLoading()

void FAsyncLoadingThread2::CancelLoading ( )
overridevirtual

Cancels streaming.

Note: Called from Game Thread.

Implements IAsyncPackageLoader.

◆ ContainsAnyPendingRequests()

bool FAsyncLoadingThread2::ContainsAnyPendingRequests ( )
inline

[ASYNC/GAME THREAD] Checks if there are any pending requests

◆ ContainsAnyRequestID()

bool FAsyncLoadingThread2::ContainsAnyRequestID ( TConstArrayView< int32 RequestIDs)
inline

[ASYNC/GAME THREAD] Checks if a request ID already is added to the loading queue

◆ ContainsRequestID()

bool FAsyncLoadingThread2::ContainsRequestID ( int32  RequestID)
inline

[ASYNC/GAME THREAD] Checks if a request ID already is added to the loading queue

◆ EnterAsyncLoadingTick()

void FAsyncLoadingThread2::EnterAsyncLoadingTick ( )
inline

Sets the current state of async loading

◆ FindAsyncPackage()

FORCEINLINE FAsyncPackage2 * FAsyncLoadingThread2::FindAsyncPackage ( FPackageId  PackageId)
inline

◆ FindOrInsertPackage()

FAsyncPackage2 * FAsyncLoadingThread2::FindOrInsertPackage ( FAsyncLoadingThreadState2 ThreadState,
FAsyncPackageDesc2 InDesc,
bool bInserted,
FAsyncPackage2 ImportedByPackage,
TUniquePtr< FLoadPackageAsyncDelegate > &&  PackageLoadedDelegate = TUniquePtr<FLoadPackageAsyncDelegate>(),
TSharedPtr< FLoadPackageAsyncProgressDelegate PackageProgressDelegate = nullptr 
)

◆ FlushLoading()

void FAsyncLoadingThread2::FlushLoading ( TConstArrayView< int32 RequestIds)
overridevirtual

Flush pending loading request(s).

Note: Called from Game Thread.

Implements IAsyncPackageLoader.

◆ FlushLoadingFromLoadingThread()

void FAsyncLoadingThread2::FlushLoadingFromLoadingThread ( FAsyncLoadingThreadState2 ThreadState,
TConstArrayView< int32 RequestIds 
)

◆ FlushLoadingFromParallelLoadingThread()

void FAsyncLoadingThread2::FlushLoadingFromParallelLoadingThread ( FAsyncLoadingThreadState2 ThreadState,
TConstArrayView< int32 RequestIds 
)

◆ GetAsyncLoadPercentage()

float FAsyncLoadingThread2::GetAsyncLoadPercentage ( const FName PackageName)
overridevirtual

[GAME THREAD] Gets the load percentage of the specified package

Parameters
PackageNameName of the package to return async load percentage for
Returns
Percentage (0-100) of the async package load or -1 of package has not been found

Implements IAsyncPackageLoader.

◆ GetAsyncPackage()

FORCEINLINE FAsyncPackage2 * FAsyncLoadingThread2::GetAsyncPackage ( const FPackageId PackageId)
inline

◆ GetIsInAsyncLoadingTick()

bool FAsyncLoadingThread2::GetIsInAsyncLoadingTick ( ) const
inline

Gets the current state of async loading

◆ GetLoaderType()

virtual ELoaderType FAsyncLoadingThread2::GetLoaderType ( ) const
inlineoverridevirtual

Implements IAsyncPackageLoader.

◆ GetNumAsyncPackages()

virtual int32 FAsyncLoadingThread2::GetNumAsyncPackages ( )
inlineoverridevirtual

Returns the number of loading packages.

Implements IAsyncPackageLoader.

◆ GetNumQueuedPackages()

virtual int32 FAsyncLoadingThread2::GetNumQueuedPackages ( )
inlineoverridevirtual

Returns the number of queued packages.

Implements IAsyncPackageLoader.

◆ Init()

bool FAsyncLoadingThread2::Init ( void  )
overridevirtual

Initializes the runnable object.

This method is called in the context of the thread object that aggregates this, not the thread that passes this runnable to a new thread.

Returns
True if initialization was successful, false otherwise
See also
Run, Stop, Exit

Reimplemented from FRunnable.

◆ InitializeLoading()

void FAsyncLoadingThread2::InitializeLoading ( )
overridevirtual

Initializes async loading thread

Implements IAsyncPackageLoader.

◆ IsAsyncLoadingPackages()

virtual bool FAsyncLoadingThread2::IsAsyncLoadingPackages ( )
inlineoverridevirtual

Returns true if packages are currently being loaded on the async thread

Implements IAsyncPackageLoader.

◆ IsAsyncLoadingSuspended()

virtual bool FAsyncLoadingThread2::IsAsyncLoadingSuspended ( )
inlineoverridevirtual

Returns true if async loading is suspended

Implements IAsyncPackageLoader.

◆ IsInAsyncLoadThread()

virtual bool FAsyncLoadingThread2::IsInAsyncLoadThread ( )
inlineoverridevirtual

Returns true this codes runs on the async loading thread

Implements IAsyncPackageLoader.

◆ IsMultithreaded()

virtual bool FAsyncLoadingThread2::IsMultithreaded ( )
inlineoverridevirtual

True if multithreaded async loading is currently being used.

Implements IAsyncPackageLoader.

◆ LeaveAsyncLoadingTick()

void FAsyncLoadingThread2::LeaveAsyncLoadingTick ( )
inline

◆ LoadPackage() [1/2]

int32 FAsyncLoadingThread2::LoadPackage ( const FPackagePath PackagePath,
FLoadPackageAsyncOptionalParams  OptionalParams 
)
overridevirtual

Asynchronously load a package.

Parameters
PackagePathPackagePath to load. Must be a mounted path. The package is created if it does not already exist.
OptionalParamsStruct containing all the parameters required to load the package.
Returns
Unique ID associated with this load request (the same package can be associated with multiple IDs).

Reimplemented from IAsyncPackageLoader.

◆ LoadPackage() [2/2]

int32 FAsyncLoadingThread2::LoadPackage ( const FPackagePath PackagePath,
FName  CustomPackageName,
FLoadPackageAsyncDelegate  InCompletionDelegate,
EPackageFlags  InPackageFlags,
int32  InPIEInstanceID,
int32  InPackagePriority,
const FLinkerInstancingContext InInstancingContext = nullptr,
uint32  InLoadFlags = LOAD_None 
)
overridevirtual

Asynchronously load a package.

Parameters
PackagePathPackagePath to load. Must be a mounted path. The package is created if it does not already exist.
CustomPackageNameIf not none, this is the name of the package to load into (and create if not yet existing). If none, the name is take from PackagePath.
InCompletionDelegateDelegate to be invoked when the packages has finished streaming
InPackageFlagsPackage flags used to construct loaded package in memory
InPIEInstanceIDPlay in Editor instance ID
InPackagePriorityLoading priority
InstancingContextAdditional context to map object names to their instanced counterpart when loading an instanced package
LoadFlagsFlags controlling loading behavior, from the ELoadFlags enum
Returns
Unique ID associated with this load request (the same package can be associated with multiple IDs).

Implements IAsyncPackageLoader.

◆ LoadPackageInternal()

int32 FAsyncLoadingThread2::LoadPackageInternal ( const FPackagePath InPackagePath,
FName  InCustomName,
TUniquePtr< FLoadPackageAsyncDelegate > &&  InCompletionDelegate,
TSharedPtr< FLoadPackageAsyncProgressDelegate InProgressDelegate,
EPackageFlags  InPackageFlags,
int32  InPIEInstanceID,
int32  InPackagePriority,
const FLinkerInstancingContext InInstancingContext,
uint32  InLoadFlags 
)

◆ NotifyCompiledVersePackage()

void FAsyncLoadingThread2::NotifyCompiledVersePackage ( Verse::VPackage *  Package)

◆ NotifyConstructedDuringAsyncLoading()

void FAsyncLoadingThread2::NotifyConstructedDuringAsyncLoading ( UObject Object,
bool  bSubObjectThatAlreadyExists 
)
overridevirtual

Call back into the async loading code to inform of the creation of a new object

Parameters
ObjectObject created
bSubObjectThatAlreadyExistsObject created as a sub-object of a loaded object

Implements IAsyncPackageLoader.

◆ NotifyRegistrationComplete()

void FAsyncLoadingThread2::NotifyRegistrationComplete ( )
overridevirtual

Implements IAsyncPackageLoader.

◆ NotifyRegistrationEvent()

void FAsyncLoadingThread2::NotifyRegistrationEvent ( FName  PackageName,
FName  Name,
ENotifyRegistrationType  NotifyRegistrationType,
ENotifyRegistrationPhase  NotifyRegistrationPhase,
UObject *(*)()  InRegister,
bool  InbDynamic,
UObject FinishedObject 
)
overridevirtual

Implements IAsyncPackageLoader.

◆ NotifyScriptVersePackage()

void FAsyncLoadingThread2::NotifyScriptVersePackage ( Verse::VPackage *  Package)
overridevirtual

Called for built in packages (currently only VVMIntrinsics.cpp) to allow them to be imported.

Reimplemented from IAsyncPackageLoader.

◆ NotifyUnreachableObjects()

void FAsyncLoadingThread2::NotifyUnreachableObjects ( const TArrayView< FUObjectItem * > &  UnreachableObjects)
overridevirtual

Implements IAsyncPackageLoader.

◆ ProcessAsyncLoadingFromGameThread()

EAsyncPackageState::Type FAsyncLoadingThread2::ProcessAsyncLoadingFromGameThread ( FAsyncLoadingThreadState2 ThreadState,
bool bDidSomething 
)

[ASYNC* THREAD] Loads all packages

Parameters
OutPackagesProcessedNumber of packages processed in this call.
Returns
The current state of async loading

◆ ProcessDeferredDeletePackagesQueue()

bool FAsyncLoadingThread2::ProcessDeferredDeletePackagesQueue ( int32  MaxCount = MAX_int32)
inline

◆ ProcessLoading()

virtual EAsyncPackageState::Type FAsyncLoadingThread2::ProcessLoading ( bool  bUseTimeLimit,
bool  bUseFullTimeLimit,
double  TimeLimit 
)
inlineoverridevirtual

Process all currently loading package requests.

Parameters
bUseTimeLimitWhether to use time limit or not
bUseFullTimeLimit
TimeLimitTime limit

Implements IAsyncPackageLoader.

◆ ProcessLoadingFromGameThread()

EAsyncPackageState::Type FAsyncLoadingThread2::ProcessLoadingFromGameThread ( FAsyncLoadingThreadState2 ThreadState,
bool  bUseTimeLimit,
bool  bUseFullTimeLimit,
double  TimeLimit 
)

◆ ProcessLoadingUntilComplete()

virtual EAsyncPackageState::Type FAsyncLoadingThread2::ProcessLoadingUntilComplete ( TFunctionRef< bool()>  CompletionPredicate,
double  TimeLimit 
)
inlineoverridevirtual

Process all loading package requests until completion predicate is satisfied.

Parameters
CompletionPredicateCompletion predicate
TimeLimitTime limit

Implements IAsyncPackageLoader.

◆ ProcessLoadingUntilCompleteFromGameThread()

EAsyncPackageState::Type FAsyncLoadingThread2::ProcessLoadingUntilCompleteFromGameThread ( FAsyncLoadingThreadState2 ThreadState,
TFunctionRef< bool()>  CompletionPredicate,
double  TimeLimit 
)

◆ QueueUnresolvedPackage()

void FAsyncLoadingThread2::QueueUnresolvedPackage ( FAsyncLoadingThreadState2 ThreadState,
EPackageStoreEntryStatus  PackageStatus,
FAsyncPackageDesc2 PackageDesc,
TUniquePtr< FLoadPackageAsyncDelegate > &&  LoadPackageAsyncDelegate,
TSharedPtr< FLoadPackageAsyncProgressDelegate LoadPackageAsyncProgressDelegate 
)

◆ RemovePendingRequests()

void FAsyncLoadingThread2::RemovePendingRequests ( FAsyncLoadingThreadState2 ThreadState,
TConstArrayView< int32 RequestIDs 
)
inline

[ASYNC/GAME THREAD] Removes a request ID from the list of pending requests

◆ ResumeLoading()

void FAsyncLoadingThread2::ResumeLoading ( )
overridevirtual

Resumes async loading thread

Note: Called from Game Thread.

Implements IAsyncPackageLoader.

◆ Run()

uint32 FAsyncLoadingThread2::Run ( )
overridevirtual

Runs the runnable object.

This is where all per object thread work is done. This is only called if the initialization was successful.

Returns
The exit code of the runnable object
See also
Init, Stop, Exit

Implements FRunnable.

◆ ShouldAlwaysLoadPackageAsync()

virtual bool FAsyncLoadingThread2::ShouldAlwaysLoadPackageAsync ( const FPackagePath PackagePath)
inlineoverridevirtual

Implements IAsyncPackageLoader.

◆ ShutdownLoading()

void FAsyncLoadingThread2::ShutdownLoading ( )
overridevirtual

Shut down loading.

Implements IAsyncPackageLoader.

◆ StartThread()

void FAsyncLoadingThread2::StartThread ( )
overridevirtual

Start the async loading thread

Implements IAsyncPackageLoader.

◆ Stop()

void FAsyncLoadingThread2::Stop ( void  )
overridevirtual

Stops the runnable object.

This is called if a thread is requested to terminate early.

See also
Init, Run, Exit

Reimplemented from FRunnable.

◆ SuspendLoading()

void FAsyncLoadingThread2::SuspendLoading ( )
overridevirtual

Suspends async loading thread

Note: Called from Game Thread.

Implements IAsyncPackageLoader.

◆ TickAsyncLoadingFromGameThread()

EAsyncPackageState::Type FAsyncLoadingThread2::TickAsyncLoadingFromGameThread ( FAsyncLoadingThreadState2 ThreadState,
bool  bUseTimeLimit,
bool  bUseFullTimeLimit,
double  TimeLimit,
TConstArrayView< int32 FlushRequestIDs,
bool bDidSomething 
)

[GAME THREAD] Ticks game thread side of async loading.

Parameters
bUseTimeLimitTrue if time limit should be used [time-slicing].
bUseFullTimeLimitTrue if full time limit should be used [time-slicing].
TimeLimitMaximum amount of time that can be spent in this call [time-slicing].
FlushTreePackage dependency tree to be flushed
Returns
The current state of async loading

◆ TickAsyncThreadFromGameThread()

EAsyncPackageState::Type FAsyncLoadingThread2::TickAsyncThreadFromGameThread ( FAsyncLoadingThreadState2 ThreadState,
bool bDidSomething 
)

[ASYNC THREAD] Main thread loop

Parameters
bUseTimeLimitTrue if time limit should be used [time-slicing].
bUseFullTimeLimitTrue if full time limit should be used [time-slicing].
TimeLimitMaximum amount of time that can be spent in this call [time-slicing].
FlushTreePackage dependency tree to be flushed

◆ UpdatePackagePriority()

void FAsyncLoadingThread2::UpdatePackagePriority ( FAsyncLoadingThreadState2 ThreadState,
FAsyncPackage2 Package 
)

◆ UpdatePackagePriorityRecursive()

void FAsyncLoadingThread2::UpdatePackagePriorityRecursive ( FAsyncLoadingThreadState2 ThreadState,
FAsyncPackage2 Package,
int32  NewPriority 
)

◆ WarnAboutPotentialSyncLoadStall()

void FAsyncLoadingThread2::WarnAboutPotentialSyncLoadStall ( FAsyncLoadingSyncLoadContext SyncLoadContext)

Friends And Related Symbol Documentation

◆ FAsyncLoadingVerseRoot

friend class FAsyncLoadingVerseRoot
friend

◆ FAsyncPackage2

Member Data Documentation

◆ AltZenaphore

FZenaphore FAsyncLoadingThread2::AltZenaphore

[EDL] Event queue

◆ EventQueue

FAsyncLoadEventQueue2 FAsyncLoadingThread2::EventQueue

◆ EventSpecs

TArray<FAsyncLoadEventSpec> FAsyncLoadingThread2::EventSpecs

◆ GraphAllocator

FAsyncLoadEventGraphAllocator FAsyncLoadingThread2::GraphAllocator

◆ MainThreadEventQueue

FAsyncLoadEventQueue2 FAsyncLoadingThread2::MainThreadEventQueue

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