Navigation
API > API/Plugins > API/Plugins/ElectraBase > API/Plugins/ElectraBase/Core
Inheritance Hierarchy
- TMediaNoncopyable
- FMediaThread
References
| Module | ElectraBase |
| Header | /Engine/Plugins/Media/ElectraUtil/Source/ElectraBase/Public/Core/MediaThreads.h |
| Include | #include "Core/MediaThreads.h" |
Syntax
class FMediaThread : private TMediaNoncopyable< FMediaThread >
Remarks
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.
Constructors
| Type | Name | Description | |
|---|---|---|---|
FMediaThread
(
const char* AnsiName |
Default constructor. Uses system defaults if no values given. |
Destructors
| Type | Name | Description | |
|---|---|---|---|
| Destructor |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | ThreadRename
(
const char* InAnsiThreadName |
Sets a new thread name once the thread is running. | |
| void | ThreadReset () |
Resets the thread to be started again. Must have waited for thread termination using ThreadWaitDone() first! | |
| void | ThreadSetCoreAffinity
(
int32 CoreAffinity |
Set a core affinity before starting the thread. Defaults to -1 for no affinity (run on any core). | |
| void | ThreadSetName
(
const char* InAnsiThreadName |
Set a thread name other than the one given to the constructor before starting the thread. | |
| void | ThreadSetPriority
(
EThreadPriority Priority |
Set a thread priority other than the one given to the constructor before starting the thread. | |
| void | ThreadSetStackSize
(
uint32 StackSize |
Set a thread stack size other than the one given to the constructor before starting the thread. | |
| void | ThreadStart
(
FMediaRunnable::FStartDelegate EntryFunction |
Starts the thread at the given function void(*)(void) | |
| void | Waits for the thread to have finished. | ||
| 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. |