Search Results for

    Show / Hide Table of Contents

    Class TaskBase

    The base of a task used by TaskDirector.

    Inheritance
    System.Object
    TaskBase
    Namespace: GDX.Threading
    Syntax
    public abstract class TaskBase

    Fields

    | Improve this Doc View Source

    completed

    An event that is triggered when the TaskBase has finished its execution.

    Declaration
    public Action<TaskBase> completed
    Field Value
    Type Description
    System.Action<TaskBase>
    Remarks

    It is super important to remember that subscribed actions will invoke off of the main thread. Any logic that requires the main thread will not work. Many of Unity's APIs are not safe for this.

    | Improve this Doc View Source

    completedMainThread

    An event that is triggered once the TaskBase has finished, during the next tick of the TaskDirector.

    Declaration
    public Action<TaskBase> completedMainThread
    Field Value
    Type Description
    System.Action<TaskBase>
    Remarks

    This is a safe way to do work which requires being executed on the main thread.

    | Improve this Doc View Source

    m_Bits

    The TaskBase's descriptive bits.

    Declaration
    protected BitArray16 m_Bits
    Field Value
    Type Description
    BitArray16
    | Improve this Doc View Source

    m_BlockingBits

    A quick set of bits used to describe tasks that should be blocked when m_BlockingModes contains Bits. The opposing TaskBase will have its m_Bits checked for positives that match.

    Declaration
    protected BitArray16 m_BlockingBits
    Field Value
    Type Description
    BitArray16
    Remarks

    If any of them are the sam

    | Improve this Doc View Source

    m_BlockingModes

    The TaskBase's blocking modes for other tasks.

    Declaration
    protected TaskBase.BlockingModeFlags m_BlockingModes
    Field Value
    Type Description
    TaskBase.BlockingModeFlags
    | Improve this Doc View Source

    m_Exception

    The exception that occured.

    Declaration
    protected Exception m_Exception
    Field Value
    Type Description
    System.Exception
    Remarks

    See IsFaulted().

    | Improve this Doc View Source

    m_IsLogging

    Should the task report information to the TaskDirector log.

    Declaration
    protected bool m_IsLogging
    Field Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    m_Name

    The user-friendly name of the task, used by different feedback systems.

    Declaration
    protected string m_Name
    Field Value
    Type Description
    System.String
    Remarks

    It's important to set this in inherited constructors.

    Methods

    | Improve this Doc View Source

    Complete()

    Forcibly completes the task on the given thread where the method is invoked.

    Declaration
    public void Complete()
    Remarks

    This will also forcibly tick the TaskDirector upon completion to trigger callbacks. You should not be using this unless you have an explicit purpose too.

    | Improve this Doc View Source

    DoWork()

    The core logic to be defined for a task.

    Declaration
    public abstract void DoWork()
    | Improve this Doc View Source

    Enqueue()

    Enqueue the current TaskBase with the TaskDirector for execution.

    Declaration
    public void Enqueue()
    | Improve this Doc View Source

    GetBits()

    Gets the associated BitArray16 with this task.

    Declaration
    public BitArray16 GetBits()
    Returns
    Type Description
    BitArray16

    The defined flags.

    | Improve this Doc View Source

    GetBlockedBits()

    Gets the BitArray16 to evaluate other tasks against.

    Declaration
    public BitArray16 GetBlockedBits()
    Returns
    Type Description
    BitArray16

    The defined bits.

    | Improve this Doc View Source

    GetBlockingModes()

    Returns the TaskBase.BlockingModeFlags used to determine other task execution.

    Declaration
    public TaskBase.BlockingModeFlags GetBlockingModes()
    Returns
    Type Description
    TaskBase.BlockingModeFlags

    A set of flags indicating if other tasks should be able to start execution.

    | Improve this Doc View Source

    GetException()

    Returns the System.Exception that was created when the task faulted.

    Declaration
    public Exception GetException()
    Returns
    Type Description
    System.Exception

    An System.Exception object.

    Remarks

    See IsFaulted().

    | Improve this Doc View Source

    GetName()

    Gets the user-friendly name of the task.

    Declaration
    public string GetName()
    Returns
    Type Description
    System.String

    The defined System.String name of the task.

    | Improve this Doc View Source

    IsBlockingAllTasks()

    Does this TaskBase block all other tasks after it from starting execution?

    Declaration
    public bool IsBlockingAllTasks()
    Returns
    Type Description
    System.Boolean

    true if this task blocks all after it, otherwise false.

    Remarks

    This will keep all tasks after it sitting waiting for this task to complete.

    | Improve this Doc View Source

    IsBlockingBits()

    Does this TaskBase block other tasks from executing based on its m_BlockingBits?

    Declaration
    public bool IsBlockingBits()
    Returns
    Type Description
    System.Boolean

    true if this tasks blocks based on bits, otherwise false.

    | Improve this Doc View Source

    IsBlockingSameName()

    Does this TaskBase block all other tasks of the same name from starting during its execution?

    Declaration
    public bool IsBlockingSameName()
    Returns
    Type Description
    System.Boolean

    true if this tasks blocks same named tasks, otherwise false.

    | Improve this Doc View Source

    IsBlockingUserInterface()

    Should the execution of this TaskBase prevent the user from providing input to the user interface?

    Declaration
    public bool IsBlockingUserInterface()
    Returns
    Type Description
    System.Boolean

    true if this task should prevent user input, otherwise false.

    Remarks

    This directly relates to the inputBlocked, altering the count used to trigger that particular event.

    | Improve this Doc View Source

    IsDone()

    Is the TaskBase finished executing?

    Declaration
    public bool IsDone()
    Returns
    Type Description
    System.Boolean

    Returns true if the execution phase of the task has been completed. This will be true if an exception has occured.

    | Improve this Doc View Source

    IsExecuting()

    Is the TaskBase currently executing on the thread pool?

    Declaration
    public bool IsExecuting()
    Returns
    Type Description
    System.Boolean

    Returns true if the task is executing, otherwise false.

    | Improve this Doc View Source

    IsFaulted()

    Did an exception occur while executing off thread?

    Declaration
    public bool IsFaulted()
    Returns
    Type Description
    System.Boolean

    Returns true if an exception occured.

    | Improve this Doc View Source

    Run()

    Execute task logic.

    Declaration
    public void Run()
    • Improve this Doc
    • View Source
    In This Article
    Back to top Built on 2024-01-01 against 1f69a68.
    Generated by Dox+DocFX.