FOnlineAsyncTaskManager

The foundation of all async operations in every online subsystem

Windows
MacOS
Linux

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

Name Description

Protected variable

FThreadSafeBool

 

bRequestingExit

Should this manager and the thread exit

Protected variable

TArray< FOnline...

 

InQueue

Game thread async tasks are queued up here for processing on the online thread

Protected variable

FCriticalSectio...

 

InQueueLock

Critical section for thread safe operation of the event in queue

Protected variable

uint32

 

OnlineThreadId

Set by FOnlineAsyncTaskManager::Run

Protected variable

TArray< FOnline...

 

OutQueue

Completed online requests are queued up here for processing on the game thread

Protected variable

FCriticalSectio...

 

OutQueueLock

Critical section for thread safe operation of the out queue

Protected variable

TArray< FOnline...

 

ParallelTasks

This queue is for tasks that are safe to run in parallel with one another

Protected variable

FCriticalSectio...

 

ParallelTasksLock

Critical section for thread safe operation of the list

Protected variable

uint32

 

PollingInterval

Min amount of time to poll for the current task to complete

Protected variable

FEvent *

 

WorkEvent

Trigger event to signal the queue has tasks that need processing

Constructors

Name Description

Public function

FOnlineAsyncTaskManager()

Destructors

Name Description

Public function Virtual

~FOnlineAsyncTaskManager()

Functions

Name Description

Public function

void

 

AddGenericToInQueue

(
    const CallableType& InCallable
)

Add a new item to the in queue that will call InCallable on the game thread.

Public function

void

 

AddGenericToInQueueOnlineThread

(
    const CallableType& InCallable
)

Add a new item to the in queue that will call InCallable on the ONLINE thread.

Public function

void

 

AddGenericToOutQueue

(
    const CallableType& InCallable
)

Add a new item to the out queue that will call InCallable on the game thread.

Public function

void

 

AddToInQueue

(
    FOnlineAsyncTask* NewTask
)

Add online async tasks that need processing onto the incoming queue

Public function

void

 

AddToOutQueue

(
    FOnlineAsyncItem* CompletedIte...
)

Add completed online async tasks that need processing onto the queue

Public function

void

 

AddToParallelTasks

(
    FOnlineAsyncTask* NewTask
)

Add a new online async task that is safe to run in parallel

Public function

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

Public function

void

 

OnlineTick()

** CALL ONLY FROM ONLINE THREAD ** Give the online service a chance to do work

Protected function

void

 

RemoveFromParallelTasks

(
    FOnlineAsyncTask* OldTask
)

Remove a parallel async task from the parallel queue

Overridden from FRunnable

Name Description

Public function Virtual

void

 

Exit()

Called in the context of the aggregating thread to perform any cleanup.

Public function Virtual

FSingleThrea...

 

GetSingleThreadInterface()

FSingleThreadRunnable accessor for ticking this FRunnable when multi-threading is disabled.

Public function Virtual

bool

 

Init()

Init the online async task manager

Public function Virtual

uint32

 

Run()

This is where all per object thread work is done.

Public function Virtual

void

 

Stop()

This is called if a thread is requested to terminate early

Overridden from FSingleThreadRunnable

Name Description

Public function Virtual

void

 

Tick()

Tick() is called by both multithreaded and single threaded runnable

Constants

Name

Description

InvocationCount

Number of async task managers running currently

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback