Class ThreadBase
Base class for thread objects.
Ensure to call Kill or Join before deleting thread object.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Platform/Base/ThreadBase.h
Syntax
public class ThreadBase : public Object, public NonCopyable
Constructors
ThreadBase(IRunnable* runnable, const String& name, ThreadPriority priority)
Declaration
protected ThreadBase(IRunnable* runnable, const String& name, ThreadPriority priority)
Parameters
IRunnable
runnable
|
String
name
|
ThreadPriority
priority
|
Fields
_callAfterWork
Declaration
protected bool _callAfterWork
Field Value
bool
|
_id
Declaration
protected uint64 _id
Field Value
uint64
|
_isRunning
Declaration
protected bool _isRunning
Field Value
bool
|
_name
_priority
_runnable
ThreadExiting
The custom event called after thread execution just before exit. Can be used to cleanup per-thread state or data. Arguments are: thread handle and exit code.
Declaration
public static Delegate<Thread* , int32> ThreadExiting
Field Value
Delegate<Thread , int32>
|
ThreadStarting
The custom event called before thread execution just after startup. Can be used to setup per-thread state or data. Argument is: thread handle.
Declaration
public static Delegate<Thread* > ThreadStarting
Field Value
Delegate<Thread >
|
Methods
ClearHandleInternal()
Declaration
protected virtual void ClearHandleInternal() = 0
GetID()
Gets thread ID
Declaration
public uint64 GetID() const
Returns
uint64
|
GetName()
GetPriority()
Gets priority level of the thread.
Declaration
public ThreadPriority GetPriority() const
Returns
ThreadPriority
|
IsRunning()
Gets thread running state.
Declaration
public bool IsRunning() const
Returns
bool
|
Join()
Stops the current thread execution and waits for the thread execution end.
Declaration
public virtual void Join() = 0
Kill(bool waitForJoin=false)
Aborts the thread execution by force.
Declaration
public void Kill(bool waitForJoin=false)
Parameters
bool
waitForJoin
True if should wait for thread end, otherwise false. |
KillInternal(bool waitForJoin)
Declaration
protected virtual void KillInternal(bool waitForJoin) = 0
Parameters
bool
waitForJoin
|
Run()
Declaration
protected int32 Run()
Returns
int32
|
SetPriority(ThreadPriority priority)
Sets priority level of the thread
Declaration
public void SetPriority(ThreadPriority priority)
Parameters
ThreadPriority
priority
The thread priority to change to. |
SetPriorityInternal(ThreadPriority priority)
Declaration
protected virtual void SetPriorityInternal(ThreadPriority priority) = 0
Parameters
ThreadPriority
priority
|
ToString()
Gets the string representation of this object.
Declaration
public virtual String ToString() const override
Returns
String
|