On FRunnable and Rama's article

I found the issue.
From the FRunnable documentation page

A runnable object is an object that is “run” on an arbitrary thread. The call usage pattern is Init() , Run() , Exit() . The thread that is going to “run” this object always uses those calling semantics.

And from the Init() declaration

This method is called in the context of the thread object that aggregates this, not the thread that passes this runnable to a new thread.

I was calling the Runnable Init() function inside the static initialization function, which is inside the player controller. The player controller is on the main thread, therefore calling Init() inside the main thread will start the new thread inside the main thread. Basically I was not multi-threading at all. That’s why my main thread was stalling.

The Init() function doesn’t need to be called manually because it’s already called inside the FRunnableThread::Run() function. And in that case, it’s already on a new thread.
That’s why deleting Init() solved my issue.

At least that’s what I think was going on. Hope I’m not mistaken and hope this helps other people! :slight_smile:

1 Like