TGraphTask

The user defined task type can take arguments to a constructor.

Windows
MacOS
Linux

Inheritance Hierarchy

FBaseGraphTask

TGraphTask

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h

Include

#include "Async/TaskGraphInterfaces.h"

Syntax

template<typename TTask>
class TGraphTask : public FBaseGraphTask

Remarks

The user defined task type can take arguments to a constructor. These arguments (unfortunately) must not be references. The API required of TTask:

class FGenericTask { TSomeType SomeArgument; public: FGenericTask(TSomeType InSomeArgument) // CAUTION!: Must not use references in the constructor args; use pointers instead if you need by reference : SomeArgument(InSomeArgument) { / Usually the constructor doesn't do anything except save the arguments for use in DoWork or GetDesiredThread. } ~FGenericTask() { / you will be destroyed immediately after you execute. Might as well do cleanup in DoWork, but you could also use a destructor. } FORCEINLINE TStatId GetStatId() const { RETURN_QUICK_DECLARE_CYCLE_STAT(FGenericTask, STATGROUP_TaskGraphTasks); }

[static] ENamedThreads::Type GetDesiredThread() { return ENamedThreads::[named thread or AnyThread]; } void DoTask(ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent) { / The arguments are useful for setting up other tasks. / Do work here, probably using SomeArgument. MyCompletionGraphEvent->DontCompleteUntil(TGraphTask<FSomeChildTask>::CreateTask(NULL,CurrentThread).ConstructAndDispatchWhenReady()); } }; TGraphTask Embeds a user defined task, as exemplified above, for doing the work and provides the functionality for setting up and handling prerequisites and subsequents

Constructors

No constructors are accessible with public or protected access.

Destructors

No destructors are accessible with public or protected access.

Functions

Name Description

Public function Static

FConstructor

 

CreateTask

(
    const FGraphEventArray* Prereq...,
    ENamedThreads::Type CurrentThreadIf...
)

Factory to create a task and return the helper object to construct the embedded task and set it up for execution.

Public function

FGraphEventR...

 

GetCompletionEvent()

Public function

void

 

Unlock

(
    ENamedThreads::Type CurrentThreadIf...
)

Classes

Name

Description

Public class

FConstructor

This is a helper class returned from the factory.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss