Navigation
API > API/Plugins > API/Plugins/OnlineSubsystem
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
| Name | FOnlineAsyncTaskManager |
| Type | class |
| Header File | /Engine/Plugins/Online/OnlineSubsystem/Source/Public/OnlineAsyncTaskManager.h |
| Include Path | #include "OnlineAsyncTaskManager.h" |
Syntax
class FOnlineAsyncTaskManager :
public FRunnable ,
private FSingleThreadRunnable
Inheritance Hierarchy
- FRunnable → FOnlineAsyncTaskManager
- FSingleThreadRunnable → FOnlineAsyncTaskManager
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FOnlineAsyncTaskManager() |
OnlineAsyncTaskManager.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FOnlineAsyncTaskManager() |
OnlineAsyncTaskManager.h |
Structs
| Name | Remarks |
|---|---|
| FOnlineThreadTickInfo |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| InvocationCount | int32 | Number of async task managers running currently | OnlineAsyncTaskManager.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ActiveSerialTask | FOnlineAsyncTask * | The current active task processed serially by the async task manager | OnlineAsyncTaskManager.h | |
| ActiveSerialTaskLock | FCriticalSection | Critical section for modifying the active serial task | OnlineAsyncTaskManager.h | |
| ActiveSerialTaskStartTime | double | When the active serial task was started on the game thread | OnlineAsyncTaskManager.h | |
| bActiveSerialTaskBreachReported | std::atomic< bool > | Has a breach been reported for the active task | OnlineAsyncTaskManager.h | |
| bEnableReportBreach | bool | Should we report a breach or not | OnlineAsyncTaskManager.h | |
| ConfigBreachTimeSeconds | float | Time to allow a serial task / the online thread tick to run before reporting | OnlineAsyncTaskManager.h | |
| OnlineThreadTickInfo | FOnlineThreadTickInfo | Info on what the online thread is currently doing | OnlineAsyncTaskManager.h | |
| OnlineThreadTickInfoLock | FCriticalSection | Critical section for modifying this tick info | OnlineAsyncTaskManager.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddGenericToInQueue
(
const CallableType& InCallable |
Add a new item to the in queue that will call InCallable on the game thread. | OnlineAsyncTaskManager.h | |
void AddGenericToInQueueOnlineThread
(
const FString& CallableName, |
Add a new item to the in queue that will call InCallable on the ONLINE thread. | OnlineAsyncTaskManager.h | |
void AddGenericToOutQueue
(
const CallableType& InCallable |
Add a new item to the out queue that will call InCallable on the game thread. | OnlineAsyncTaskManager.h | |
void AddToInQueue
(
FOnlineAsyncTask* NewTask |
Add online async tasks that need processing onto the incoming queue | OnlineAsyncTaskManager.h | |
void AddToOutQueue
(
FOnlineAsyncItem* CompletedItem |
Add completed online async tasks that need processing onto the queue | OnlineAsyncTaskManager.h | |
void AddToParallelTasks
(
FOnlineAsyncTask* NewTask |
Add a new online async task that is safe to run in parallel | OnlineAsyncTaskManager.h | |
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 | OnlineAsyncTaskManager.h | |
void OnlineTick() |
** CALL ONLY FROM ONLINE THREAD ** Give the online service a chance to do work | OnlineAsyncTaskManager.h |
Overridden from FRunnable
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Exit() |
Called in the context of the aggregating thread to perform any cleanup. | OnlineAsyncTaskManager.h | |
virtual FSingleThreadRunnable * GetSingleThreadInterface() |
FSingleThreadRunnable accessor for ticking this FRunnable when multi-threading is disabled. | OnlineAsyncTaskManager.h | |
virtual bool Init() |
Init the online async task manager | OnlineAsyncTaskManager.h | |
virtual uint32 Run () |
This is where all per object thread work is done. | OnlineAsyncTaskManager.h | |
virtual void Stop() |
This is called if a thread is requested to terminate early | OnlineAsyncTaskManager.h |
Overridden from FSingleThreadRunnable
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Tick() |
Tick() is called by both multithreaded and single threaded runnable | OnlineAsyncTaskManager.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void RemoveFromParallelTasks
(
FOnlineAsyncTask* OldTask |
Remove a parallel async task from the parallel queue | OnlineAsyncTaskManager.h |