UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FAutoDeleteAsyncTask< TTask > Class Template Reference

#include <AsyncWork.h>

+ Inheritance diagram for FAutoDeleteAsyncTask< TTask >:

Public Member Functions

template<typename... T>
 FAutoDeleteAsyncTask (T &&... Args)
 
void StartSynchronousTask ()
 
void StartBackgroundTask (FQueuedThreadPool *InQueuedPool=GThreadPool, EQueuedWorkPriority InPriority=EQueuedWorkPriority::Normal)
 

Detailed Description

template<typename TTask>
class FAutoDeleteAsyncTask< TTask >
FAutoDeleteAsyncTask - template task for jobs that delete themselves when complete

Sample code:

class ExampleAutoDeleteAsyncTask : public FNonAbandonableTask
{
    friend class FAutoDeleteAsyncTask<ExampleAutoDeleteAsyncTask>;

    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<ExampleAutoDeleteAsyncTask>(5)->StartBackgroundTask();

do an example job now, on this thread (new FAutoDeleteAsyncTask<ExampleAutoDeleteAsyncTask>(5)->StartSynchronousTask(); }

Constructor & Destructor Documentation

◆ FAutoDeleteAsyncTask()

template<typename TTask >
template<typename... T>
FAutoDeleteAsyncTask< TTask >::FAutoDeleteAsyncTask ( T &&...  Args)
inlineexplicit

Forwarding constructor.

Member Function Documentation

◆ StartBackgroundTask()

template<typename TTask >
void FAutoDeleteAsyncTask< TTask >::StartBackgroundTask ( FQueuedThreadPool InQueuedPool = GThreadPool,
EQueuedWorkPriority  InPriority = EQueuedWorkPriority::Normal 
)
inline

Run this task on the lo priority thread pool. It is not safe to use this object after this call.

◆ StartSynchronousTask()

template<typename TTask >
void FAutoDeleteAsyncTask< TTask >::StartSynchronousTask ( )
inline

Run this task on this thread, now. Will end up destroying myself, so it is not safe to use this object after this call.


The documentation for this class was generated from the following file: