![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <RunnableThread.h>
Inheritance diagram for FRunnableThread:Public Types | |
| enum class | ThreadType { Real , Fake , Forkable } |
Public Member Functions | |
| virtual void | SetThreadPriority (EThreadPriority NewPriority)=0 |
| virtual bool | SetThreadAffinity (const FThreadAffinity &Affinity) |
| virtual void | Suspend (bool bShouldPause=true)=0 |
| virtual bool | Kill (bool bShouldWait=true)=0 |
| virtual void | WaitForCompletion ()=0 |
| virtual FRunnableThread::ThreadType | GetThreadType () const |
| const uint32 | GetThreadID () const |
| const FString & | GetThreadName () const |
| EThreadPriority | GetThreadPriority () const |
| CORE_API | FRunnableThread () |
| virtual CORE_API | ~FRunnableThread () |
Static Public Member Functions | |
| static CORE_API uint32 | GetTlsSlot () |
| static CORE_API FRunnableThread * | Create (class FRunnable *InRunnable, const TCHAR *ThreadName, uint32 InStackSize=0, EThreadPriority InThreadPri=TPri_Normal, uint64 InThreadAffinityMask=FPlatformAffinity::GetNoAffinityMask(), EThreadCreateFlags InCreateFlags=EThreadCreateFlags::None) |
| static FRunnableThread * | GetRunnableThread () |
Protected Member Functions | |
| virtual bool | CreateInternal (FRunnable *InRunnable, const TCHAR *InThreadName, uint32 InStackSize=0, EThreadPriority InThreadPri=TPri_Normal, uint64 InThreadAffinityMask=0, EThreadCreateFlags InCreateFlags=EThreadCreateFlags::None)=0 |
| CORE_API void | SetTls () |
| CORE_API void | FreeTls () |
Protected Attributes | |
| FString | ThreadName |
| FRunnable * | Runnable |
| FEvent * | ThreadInitSyncEvent |
| uint64 | ThreadAffinityMask |
| EThreadPriority | ThreadPriority |
| uint32 | ThreadID |
Friends | |
| class | FThreadSingletonInitializer |
| class | FTlsAutoCleanup |
| class | FThreadManager |
| class | FForkableThread |
| class | FForkProcessHelper |
Interface for runnable threads.
This interface specifies the methods used to manage a thread's life cycle.
|
strong |
| FRunnableThread::FRunnableThread | ( | ) |
Default constructor.
|
virtual |
Virtual destructor
|
static |
Factory method to create a thread with the specified stack size and thread priority.
| InRunnable | The runnable object to execute |
| ThreadName | Name of the thread |
| InStackSize | The size of the stack to create. 0 means use the current thread's stack size |
| InThreadPri | Tells the thread whether it needs to adjust its priority or not. Defaults to normal priority |
|
protectedpure virtual |
Creates the thread with the specified stack size and thread priority.
| InRunnable | The runnable object to execute |
| ThreadName | Name of the thread |
| InStackSize | The size of the stack to create. 0 means use the current thread's stack size |
| InThreadPri | Tells the thread whether it needs to adjust its priority or not. Defaults to normal priority |
Implemented in FForkableThread, FFakeThread, and FRunnableThreadWin.
|
protected |
Deletes all FTlsAutoCleanup objects created for this thread.
|
inlinestatic |
|
inline |
|
inline |
|
inline |
Returns the runnable's thread priority
|
inlinevirtual |
Returns the type of thread this is
Reimplemented in FFakeThread, and FForkableThread.
|
static |
Gets a new Tls slot for storing the runnable thread pointer.
Tells the thread to exit. If the caller needs to know when the thread has exited, it should use the bShouldWait value. It's highly recommended not to kill the thread without waiting for it. Having a thread forcibly destroyed can cause leaks and deadlocks.
The kill method is calling Stop() on the runnable to kill the thread gracefully.
| bShouldWait | If true, the call will wait infinitely for the thread to exit. |
Implemented in FFakeThread, FForkableThread, and FRunnableThreadWin.
|
inlinevirtual |
Changes the thread affinity of the currently running thread
| ThreadAffinityMask | The thread affinity to change to (can be 0 to keep previously set affinity mask) |
| ProcessorGroup | The thread group to change to |
Reimplemented in FRunnableThreadWin.
|
pure virtual |
Changes the thread priority of the currently running thread
| NewPriority | The thread priority to change to |
Implemented in FFakeThread, FForkableThread, and FRunnableThreadWin.
|
protected |
Stores this instance in the runnable thread TLS slot.
Tells the thread to either pause execution or resume depending on the passed in value.
| bShouldPause | Whether to pause the thread (true) or resume (false) |
Implemented in FFakeThread, FForkableThread, and FRunnableThreadWin.
Halts the caller until this thread is has completed its work.
Implemented in FFakeThread, FForkableThread, and FRunnableThreadWin.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
The runnable object to execute on this thread.
|
protected |
The Affinity to run the thread with.
|
protected |
ID set during thread creation.
|
protected |
Sync event to make sure that Init() has been completed before allowing the main thread to continue.
|
protected |
Holds the name of the thread.
|
protected |
The priority to run the thread at.