Calling methods from uint32 FRunnable::Run()?
Does calling an object method in the Run method of FRunnable happen in its own thread that runs the said FRunnable instead of running in the game thread? The method itself is thread-safe, being const & just doing some heavy weight calculations, but it needs to be a method, instead of static, otherwise too much data has to be copied onto the thread. I tried running Sleep inside it & it didn't halt the game thread, but it did halt the worker, so I assume it works correctly, but I'll ask just to be sure none the less.
It will run on thread which executes Run, which is thread that FRunnable is running
C++ by it self by pure syntax is not support multi-threading, the functions that generate instructions for CPU to create and switch threads or call function in OS that does that is one what makes multi-threading work in C++, but it's not really C++ feature. C++ compiler compiles functions to machine code as they are without even thinking about threading, the called function would need to switch thread on there own to do so, and which as much as i seen ton gameplay code in engine i never seen it using multithreading (well maybe except tick system?).
So your call in Run will simply make current thread jump to function you called, it will does that because CPU instructions generated by compiler will order it to do so.
Follow this question
Once you sign in you will be able to subscribe for any updates here