FRunnableThread

Interface for runnable threads.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/HAL/RunnableThread.h

Include

#include "HAL/RunnableThread.h"

Syntax

class FRunnableThread

Remarks

Interface for runnable threads.

This interface specifies the methods used to manage a thread's life cycle.

Variables

Name Description

Protected variable

FRunnable *

 

Runnable

The runnable object to execute on this thread.

Protected variable

uint64

 

ThreadAffinityMask

The Affinity to run the thread with.

Protected variable

uint32

 

ThreadID

ID set during thread creation.

Protected variable

FEvent *

 

ThreadInitSyncEvent

Sync event to make sure that Init() has been completed before allowing the main thread to continue.

Protected variable

FString

 

ThreadName

Holds the name of the thread.

Protected variable

EThreadPriority

 

ThreadPriority

The priority to run the thread at.

Protected variable

TArray< FTlsAut...

 

TlsInstances

An array of FTlsAutoCleanup based instances that needs to be deleted before the thread will die.

Constructors

Name Description

Public function

FRunnableThread()

Default constructor.

Destructors

Name Description

Public function Virtual

~FRunnableThread()

Virtual destructor

Functions

Name Description

Public function Static

FRunnableThr...

 

Create

(
    FRunnable* InRunnable,
    const TCHAR* ThreadName,
    uint32 InStackSize,
    EThreadPriority InThreadPri,
    uint64 InThreadAffinityMask,
    EThreadCreateFlags InCreateFlags
)

Factory method to create a thread with the specified stack size and thread priority.

Protected function

bool

 

CreateInternal

(
    FRunnable* InRunnable,
    const TCHAR* InThreadName,
    uint32 InStackSize,
    EThreadPriority InThreadPri,
    uint64 InThreadAffinityMask,
    EThreadCreateFlags InCreateFlags
)

Creates the thread with the specified stack size and thread priority.

Protected function

void

 

FreeTls()

Deletes all FTlsAutoCleanup objects created for this thread.

Protected function Static

FRunnableThr...

 

GetRunnableThread()

Public function Const

const uint32

 

GetThreadID()

Thread ID for this thread

Public function Const

const FStrin...

 

GetThreadName()

Retrieves the given name of the thread

Public function Static

uint32

 

GetTlsSlot()

Gets a new Tls slot for storing the runnable thread pointer.

Public function

bool

 

Kill

(
    bool bShouldWait
)

Tells the thread to exit.

Public function

void

 

SetThreadPriority

(
    EThreadPriority NewPriority
)

Changes the thread priority of the currently running thread

Protected function

void

 

SetTls()

Stores this instance in the runnable thread TLS slot.

Public function

void

 

Suspend

(
    bool bShouldPause
)

Tells the thread to either pause execution or resume depending on the passed in value.

Public function

void

 

WaitForCompletion()

Halts the caller until this thread is has completed its work.

Constants

Name

Description

RunnableTlsSlot

Index of TLS slot for FRunnableThread pointer.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss