Navigation
API > API/Runtime > API/Runtime/Core
Description
Execute a given function asynchronously.
Usage examples:
// using global function int TestFunc() { return 123; }
TUniqueFunction
// using lambda TUniqueFunction
auto Result = Async(EAsyncExecution::Thread, Task);
// using inline lambda auto Result = Async(EAsyncExecution::Thread, []() { return 123; }
| Name | Async |
| Type | function |
| Header File | /Engine/Source/Runtime/Core/Public/Async/Async.h |
| Include Path | #include "Async/Async.h" |
template<typename CallableType>
TFuture < decltype)> Async
(
EAsyncExecution Execution,
CallableType && Callable,
TUniqueFunction < void> CompletionCallback
)
A TFuture object that will receive the return value from the function.
Parameters
| Name | Remarks |
|---|---|
| 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. |