Navigation
Unreal Engine C++ API Reference > Plugins > OnlineSubsystem
Inheritance Hierarchy
- FRunnable
- FSingleThreadRunnable
- FOnlineAsyncTaskManager
References
Module | OnlineSubsystem |
Header | /Engine/Plugins/Online/OnlineSubsystem/Source/Public/OnlineAsyncTaskManager.h |
Include | #include "OnlineAsyncTaskManager.h" |
Syntax
class FOnlineAsyncTaskManager :
public FRunnable ,
private FSingleThreadRunnable
Remarks
The foundation of all async operations in every online subsystem
A task manager ticks on its own thread, managing both a serial and parallel queue of FOnlineAsyncTasks Each task works through the serial queue in the following manner GameThread
- Initialize() OnlineThread Tick() until IsDone() Add task to OutQueue GameThread
- Finalize()
- TriggerDelegates()
Parallel task queue works in a similar flow, except the tasks don't wait for any previous tasks to complete
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
std::atomic< bool > | bReloadMaxParallelTasksConfig | Signal game thread to reload the MaxParallelTasks value from config |
![]() |
FThreadSafeBool | bRequestingExit | Should this manager and the thread exit |
![]() |
int32 | MaxParallelTasks | Number of tasks that can run in parallel |
![]() |
volatile uint32 | OnlineThreadId | Set by FOnlineAsyncTaskManager::Run |
![]() |
TArray< FOnlineAsyncItem * > | OutQueue | Completed online requests are queued up here for processing on the game thread |
![]() |
FCriticalSection | OutQueueLock | Critical section for thread safe operation of the out queue |
![]() |
TArray< FOnlineAsyncTask * > | ParallelTasks | Tasks that are running in parallel |
![]() |
FCriticalSection | ParallelTasksLock | Critical section for thread safe operation of the list |
![]() |
uint32 | PollingInterval | Min amount of time to poll for the current task to complete |
![]() |
TQueue< FOnlineAsyncTask *, EQueueMode::Mpsc > | QueuedParallelTasks | This queue is for tasks that are safe to run in parallel with one another |
![]() |
TArray< FOnlineAsyncTask * > | QueuedSerialTasks | Game thread async tasks are queued up here for processing on the online thread |
![]() |
FCriticalSection | QueuedSerialTasksLock | Critical section for thread safe operation of the event in queue |
![]() |
FEvent * | WorkEvent | Trigger event to signal the queue has tasks that need processing |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
Destructors
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
Functions
Type | Name | Description | |
---|---|---|---|
![]() |
void | AddGenericToInQueue
(
const CallableType& InCallable |
Add a new item to the in queue that will call InCallable on the game thread. |
![]() |
void | AddGenericToInQueueOnlineThread
(
const FString& CallableName, |
Add a new item to the in queue that will call InCallable on the ONLINE thread. |
![]() |
void | AddGenericToOutQueue
(
const CallableType& InCallable |
Add a new item to the out queue that will call InCallable on the game thread. |
![]() |
void | AddToInQueue
(
FOnlineAsyncTask* NewTask |
Add online async tasks that need processing onto the incoming queue |
![]() |
void | AddToOutQueue
(
FOnlineAsyncItem* CompletedItem |
Add completed online async tasks that need processing onto the queue |
![]() |
void | AddToParallelTasks
(
FOnlineAsyncTask* NewTask |
Add a new online async task that is safe to run in parallel |
![]() |
void | GameTick () |
** CALL ONLY FROM GAME THREAD ** Give the completed async tasks a chance to marshal their data back onto the game thread Calling delegates where appropriate |
![]() |
void | OnlineTick () |
** CALL ONLY FROM ONLINE THREAD ** Give the online service a chance to do work |
![]() |
void | RemoveFromParallelTasks
(
FOnlineAsyncTask* OldTask |
Remove a parallel async task from the parallel queue |
Overridden from FRunnable
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | Exit () |
Called in the context of the aggregating thread to perform any cleanup. |
![]() ![]() |
FSingleThreadRunnable * | FSingleThreadRunnable accessor for ticking this FRunnable when multi-threading is disabled. | |
![]() ![]() |
bool | Init () |
Init the online async task manager |
![]() ![]() |
uint32 | Run () |
This is where all per object thread work is done. |
![]() ![]() |
void | Stop () |
This is called if a thread is requested to terminate early |
Overridden from FSingleThreadRunnable
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | Tick () |
Tick() is called by both multithreaded and single threaded runnable |
Constants
Name | Description |
---|---|
InvocationCount | Number of async task managers running currently |