Navigation
API > API/Runtime > API/Runtime/Core
FAutoDeleteAsyncTask - template task for jobs that delete themselves when complete
Sample code:
class ExampleAutoDeleteAsyncTask : public FNonAbandonableTask
{
friend class FAutoDeleteAsyncTask
int32 ExampleData;
ExampleAutoDeleteAsyncTask(int32 InExampleData) : ExampleData(InExampleData) { }
void DoWork() { ... do the work here }
FORCEINLINE TStatId GetStatId() const { RETURN_QUICK_DECLARE_CYCLE_STAT(ExampleAutoDeleteAsyncTask, STATGROUP_ThreadPoolAsyncTasks); } };
void Example()
{
/ start an example job (new FAutoDeleteAsyncTask
/ do an example job now, on this thread (new FAutoDeleteAsyncTask
| Name | FAutoDeleteAsyncTask |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Async/AsyncWork.h |
| Include Path | #include "Async/AsyncWork.h" |
Syntax
template<typename TTask>
class FAutoDeleteAsyncTask :
private UE::FInheritedContextBase ,
private IQueuedWork
Inheritance Hierarchy
- FInheritedContextBase → FAutoDeleteAsyncTask
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FAutoDeleteAsyncTask
(
T&&... Args |
Forwarding constructor. | Async/AsyncWork.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Task | TTask | User job embedded in this task | Async/AsyncWork.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void StartBackgroundTask
(
FQueuedThreadPool* InQueuedPool, |
Run this task on the lo priority thread pool. It is not safe to use this object after this call. | Async/AsyncWork.h | |
void StartSynchronousTask () |
Run this task on this thread, now. | Async/AsyncWork.h |