I understand that “this” is a reference to the main thread but in which class can i call this method ?
Where do my unreal project start ? in ProjectGameMode.cpp ?
Last question Can I change the attribute of an AActor in an oher Thread than the GameThread ?
Okay, I know that the topic was created 3 years ago. However, I am studying multithreading at the moment and I think it will be useful for everyone else. Since such examples with full implementation on the Internet, I did not find. You just have to dig into the engine code.
You can start your stream, for example, from the BeginPlay method (do not forget to add it to the header file if you don’t have one)
And also do not forget to add stream tearing to EndPlay. In my case, until the thread stopped calculating - I just could not finish the game process, otherwise the engine crashed
Look up thread fencing and render fencing in UE4. It’s similar to using a thread dispatcher and then waiting for all the threads to report back when they’re done. You will block on stepping to the next line of code in the sequence until the fence completes.