Navigation
API > API/Plugins > API/Plugins/ElectraBase
A thread base class to either inherit from or use as a variable.
Thread parameters are given to constructor but can be changed before starting the thread with the ThreadSet..() functions. This allows the constructor to use system default values so an instance of this class can be used as a member variable of some class.
To start the thread on some function of type void(*)(void) call ThreadStart() with an appropriate delegate.
IMPORTANT: If used as a member variable you have to ensure for your class to stay alive i.e. not be destroyed before the thread function has finished. Otherwise your function will most likely crash. Either wait for thread completion by calling ThreadWaitDone()OR have the destructor wait for the thread itself by calling ThreadWaitDoneOnDelete(true) at some point prior to destruction - preferably before starting the thread.
| Name | FMediaThread |
| Type | class |
| Header File | /Engine/Plugins/Media/ElectraUtil/Source/ElectraBase/Public/Core/MediaThreads.h |
| Include Path | #include "Core/MediaThreads.h" |
Syntax
class FMediaThread : private TMediaNoncopyable< FMediaThread >
Inheritance Hierarchy
- TMediaNoncopyable → FMediaThread
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMediaThread
(
const char* AnsiName |
Default constructor. Uses system defaults if no values given. | Core/MediaThreads.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FMediaThread() |
Destructor | Core/MediaThreads.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bIsStarted | bool | Core/MediaThreads.h | ||
| bWaitDoneOnDelete | bool | Core/MediaThreads.h | ||
| CoreAffinity | int32 | Core/MediaThreads.h | ||
| MediaRunnable | FMediaRunnable * | Core/MediaThreads.h | ||
| Priority | EThreadPriority | Core/MediaThreads.h | ||
| SigDone | FMediaEvent | Core/MediaThreads.h | ||
| StackSize | uint32 | Core/MediaThreads.h | ||
| ThreadName | FString | Core/MediaThreads.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ThreadRename
(
const char* InAnsiThreadName |
Sets a new thread name once the thread is running. | Core/MediaThreads.h | |
void ThreadReset() |
Resets the thread to be started again. Must have waited for thread termination using ThreadWaitDone() first! | Core/MediaThreads.h | |
void ThreadSetCoreAffinity
(
int32 CoreAffinity |
Set a core affinity before starting the thread. Defaults to -1 for no affinity (run on any core). | Core/MediaThreads.h | |
void ThreadSetName
(
const char* InAnsiThreadName |
Set a thread name other than the one given to the constructor before starting the thread. | Core/MediaThreads.h | |
void ThreadSetPriority
(
EThreadPriority Priority |
Set a thread priority other than the one given to the constructor before starting the thread. | Core/MediaThreads.h | |
void ThreadSetStackSize
(
uint32 StackSize |
Set a thread stack size other than the one given to the constructor before starting the thread. | Core/MediaThreads.h | |
void ThreadStart
(
FMediaRunnable::FStartDelegate EntryFunction |
Starts the thread at the given function void(*)(void) | Core/MediaThreads.h | |
void ThreadWaitDone() |
Waits for the thread to have finished. | Core/MediaThreads.h | |
void ThreadWaitDoneOnDelete
(
bool bWait |
Sets whether or not the destructor needs to wait for the thread to have finished. Defaults to false. Useful when using this as a member variable. | Core/MediaThreads.h |