The user defined task type can take arguments to a constructor. 更多...
#include <TaskGraphInterfaces.h>
类 TGraphTask< TTask > 继承关系图:类 | |
| class | FConstructor |
| This is a helper class returned from the factory. 更多... | |
静态 Public 成员函数 | |
| static FConstructor | CreateTask (const FGraphEventArray *Prerequisites=NULL, ENamedThreads::Type CurrentThreadIfKnown=ENamedThreads::AnyThread) |
| Factory to create a task and return the helper object to construct the embedded task and set it up for execution. 更多... | |
友元 | |
| class | FGraphEvent |
额外继承的成员函数 | |
Public 类型 继承自 FBaseGraphTask | |
| enum | { SMALL_TASK_SIZE = 256 } |
Protected 成员函数 继承自 FBaseGraphTask | |
| void | ConditionalQueueTask (ENamedThreads::Type CurrentThread) |
| An indication that a prerequisite has been completed. 更多... | |
| FBaseGraphTask (int32 InNumberOfPrerequistitesOutstanding) | |
| Constructor 更多... | |
| void | PrerequisitesComplete (ENamedThreads::Type CurrentThread, int32 NumAlreadyFinishedPrequistes, bool bUnlock=true) |
| Indicates that the prerequisites are set up and that the task can be executed as soon as the prerequisites are finished. 更多... | |
| void | SetThreadToExecuteOn (ENamedThreads::Type InThreadToExecuteOn) |
| Sets the desired execution thread. 更多... | |
| virtual | ~FBaseGraphTask () |
| destructor, just checks the life stage | |
静态 Protected 成员函数 继承自 FBaseGraphTask | |
| static CORE_API TSmallTaskAllocator & | GetSmallTaskAllocator () |
| Singleton to retrieve the small task allocator | |
| static void CORE_API | LogPossiblyInvalidSubsequentsTask (const TCHAR *TaskName) |
| Logs a task name that may contain invalid subsequents. 更多... | |
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
|
inlinestatic |
Factory to create a task and return the helper object to construct the embedded task and set it up for execution.
| Prerequisites; | the list of FGraphEvents that must be completed prior to this task executing. |
| CurrentThreadIfKnown; | provides the index of the thread we are running on. Can be ENamedThreads::AnyThread if the current thread is unknown. |