![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "Async/Future.h"#include "Async/TaskGraphInterfaces.h"#include "Containers/UnrealString.h"#include "CoreTypes.h"#include "HAL/PlatformAffinity.h"#include "HAL/PlatformProcess.h"#include "HAL/Runnable.h"#include "HAL/RunnableThread.h"#include "HAL/ThreadSafeCounter.h"#include "Misc/AssertionMacros.h"#include "Misc/CoreStats.h"#include "Misc/Fork.h"#include "Misc/IQueuedWork.h"#include "Misc/QueuedThreadPool.h"#include "Containers/Ticker.h"#include "Stats/Stats.h"#include "Templates/Function.h"#include "Templates/UnrealTemplate.h"Go to the source code of this file.
Classes | |
| class | FAsyncGraphTaskBase |
| class | TAsyncGraphTask< ResultType > |
| class | TAsyncRunnable< ResultType > |
| class | TAsyncQueuedWork< ResultType > |
| struct | FAsyncThreadIndex |
Enumerations | |
| enum class | EAsyncExecution { TaskGraph , TaskGraphMainThread , TaskGraphMainTick , Thread , ThreadIfForkSafe , ThreadPool } |
|
strong |
Enumerates available asynchronous execution methods.
| auto Async | ( | EAsyncExecution | Execution, |
| CallableType && | Callable, | ||
| TUniqueFunction< void()> | CompletionCallback = nullptr |
||
| ) | -> TFuture<decltype(Forward<CallableType>(Callable)())> |
Execute a given function asynchronously.
Usage examples:
// using global function int TestFunc() { return 123; }
TUniqueFunction<int()> Task = TestFunc(); auto Result = Async(EAsyncExecution::Thread, Task);
// using lambda TUniqueFunction<int()> Task = []() { return 123; }
auto Result = Async(EAsyncExecution::Thread, Task);
// using inline lambda auto Result = Async(EAsyncExecution::Thread, []() { return 123; }
| CallableType | The type of callable object. |
| Execution | The execution method to use, i.e. on Task Graph or in a separate thread. |
| Function | The function to execute. |
| CompletionCallback | An optional callback function that is executed when the function completed execution. |
| auto AsyncPool | ( | FQueuedThreadPool & | ThreadPool, |
| CallableType && | Callable, | ||
| TUniqueFunction< void()> | CompletionCallback = nullptr, |
||
| EQueuedWorkPriority | InQueuedWorkPriority = EQueuedWorkPriority::Normal |
||
| ) | -> TFuture<decltype(Forward<CallableType>(Callable)())> |
Execute a given function asynchronously on the specified thread pool.
| CallableType | The type of callable object. |
| ThreadPool | The thread pool to execute on. |
| Function | The function to execute. |
| CompletionCallback | An optional callback function that is executed when the function completed execution. |
| CORE_API void AsyncTask | ( | ENamedThreads::Type | Thread, |
| TUniqueFunction< void()> | Function | ||
| ) |
Convenience function for executing code asynchronously on the Task Graph.
| Thread | The name of the thread to run on. |
| Function | The function to execute. |
| auto AsyncThread | ( | CallableType && | Callable, |
| uint32 | StackSize = 0, |
||
| EThreadPriority | ThreadPri = TPri_Normal, |
||
| TUniqueFunction< void()> | CompletionCallback = nullptr |
||
| ) | -> TFuture<decltype(Forward<CallableType>(Callable)())> |
Execute a given function asynchronously using a separate thread.
| CallableType | The type of callable object. |
| Function | The function to execute. |
| StackSize | stack space to allocate for the new thread |
| ThreadPri | thread priority |
| CompletionCallback | An optional callback function that is executed when the function completed execution. |
|
inline |
Template for setting a promise value from a callable.
|
inline |