Why does FPlatformProcess::Sleep sleep all threads (including the game thread)? (FRunnable)

I’m trying to create threads.
I actually think they are created correctly.

If I run them this way there is no problem, and I can see that the thread ids are different numbers.

	virtual uint32 Run() override
	{		
		if (Thread!=nullptr) 
        Message::Warning("ThreadID --> " 
        + FString::FromInt(Thread->GetThreadID()));	
		return 0;
	}

However when I run them this way the whole game freezes.

	virtual uint32 Run() override
	{		
		while (bRunThread)
		{
			FPlatformProcess::Sleep(1.0f);
		}		
		return 0;
	}

I think FPlatformProcess::Sleep is sleeping on the game thread too…

But in theory this should not happen. All the examples I have seen use FPlatformProcess::Sleep inside the Run() function.

Does anyone know what the problem could be?

Thank you so much!!


Has anyone had the same problem…
but I can’t find a solution on the forum

Ok… I got it

Most tutorials I’ve seen leave out the most important part. “How to run”
Why do you make a tutorial if it doesn’t show everything?

The Run() function is executed automatically.
Should not be run from the main thread.

Benui is the best…

Thank you very much Benui!!