Choose your operating system:
Windows
macOS
Linux
| FBaseGraphTask
|
Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h |
Include |
#include "Async/TaskGraphInterfaces.h" |
template<typename TTask>
class TGraphTask : public FBaseGraphTask
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
No constructors are accessible with public or protected access.
No destructors are accessible with public or protected access.
Name | Description | ||
---|---|---|---|
|
CreateTask ( |
Factory to create a task and return the helper object to construct the embedded task and set it up for execution. |
|
|
FGraphEventR... |
GetCompletionEvent() |
|
|
Unlock ( |
Name |
Description |
|
---|---|---|
|
FConstructor |
This is a helper class returned from the factory. |