Hello. I know how to call the functions Async template and FFunctionGraphTask::CreateAndDispatchWhenReady.
But I don’t know how to get the result. I want to do a lot of math operations and return TArray as result and call the function in the main thread.
For example:
FGraphEventRef DoThisTask = FFunctionGraphTask::CreateAndDispatchWhenReady([&a1]()
{
a1 = 400;
UE_LOG(LogTemp, Warning, TEXT("Variable a1 %d"), a1);
}, TStatId(), NULL, ENamedThreads::AnyThread);
Or
AsyncTask(ENamedThreads::AnyHiPriThreadNormalTask, [FindedActors, this]()
{
// something
}
});
But I don’t know how to get the result.
Question 2: how to send the data to the child thread ? For example I want the Async thread to stop when I call some function in a class. How do I stop the thread ?
Thanks.