Search Results for

    Show / Hide Table of Contents

    Class ThreadBase

    Base class for thread objects.

    Ensure to call Kill or Join before deleting thread object.

    Inheritance
    Object
    ThreadBase
    Inherited Members
    Object::DeleteObject(float timeToLive = 0.0f, bool useGameTime=false)
    Object::DeleteObjectNow()
    Object::Flags
    NonCopyable::NonCopyable()
    NonCopyable::NonCopyable(const NonCopyable& )
    Object::OnDeleteObject()
    NonCopyable::operator=(const NonCopyable& )
    Object::~Object()
    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

    Declaration
    protected String _name
    Field Value
    String

    _priority

    Declaration
    protected ThreadPriority _priority
    Field Value
    ThreadPriority

    _runnable

    Declaration
    protected IRunnable* _runnable
    Field Value
    IRunnable

    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()

    Gets name of the thread.

    Declaration
    public String GetName() const
    Returns
    String

    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

    Overrides
    Object::ToString()
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat