FRunnableThread

Interface for runnable threads.

Windows
MacOS
Linux

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
)

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
)

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.

References

Module

Core

Header

Runtime/Core/Public/HAL/RunnableThread.h

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback