Search Results for

    Show / Hide Table of Contents

    Class SingleThreadTaskScheduler

    A single-threaded task scheduler that runs all of its tasks on the same thread.

    Inheritance
    System.Object
    System.Threading.Tasks.TaskScheduler
    SingleThreadTaskScheduler
    Implements
    System.IDisposable
    Inherited Members
    System.Threading.Tasks.TaskScheduler.TryDequeue(System.Threading.Tasks.Task)
    System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext()
    System.Threading.Tasks.TaskScheduler.TryExecuteTask(System.Threading.Tasks.Task)
    System.Threading.Tasks.TaskScheduler.MaximumConcurrencyLevel
    System.Threading.Tasks.TaskScheduler.Default
    System.Threading.Tasks.TaskScheduler.Current
    System.Threading.Tasks.TaskScheduler.Id
    System.Threading.Tasks.TaskScheduler.UnobservedTaskException
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: IPA.Utilities.Async
    Assembly: IPA.Loader.dll
    Syntax
    public class SingleThreadTaskScheduler : TaskScheduler, IDisposable

    Properties

    | Improve this Doc View Source

    IsRunning

    Gets whether or not the underlying thread has been started.

    Declaration
    public bool IsRunning { get; }
    Property Value
    Type Description
    System.Boolean
    Exceptions
    Type Condition
    System.ObjectDisposedException

    Thrown if this object has already been disposed.

    Methods

    | Improve this Doc View Source

    Dispose()

    Disposes this object. This puts the object into an unusable state.

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

    Dispose(Boolean)

    Disposes this object.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    whether or not to dispose managed objects

    | Improve this Doc View Source

    Exit()

    Terminates the runner thread, and waits for the currently running task to complete.

    Declaration
    public IEnumerable<Task> Exit()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task>

    an System.Collections.Generic.IEnumerable<T> of System.Threading.Tasks.Tasks that did not execute

    Remarks

    After this method returns, this object has been disposed and is no longer in a valid state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    Thrown if this object has already been disposed.

    | Improve this Doc View Source

    GetScheduledTasks()

    Throws a System.NotSupportedException.

    Declaration
    protected override IEnumerable<Task> GetScheduledTasks()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task>

    nothing

    Overrides
    System.Threading.Tasks.TaskScheduler.GetScheduledTasks()
    Exceptions
    Type Condition
    System.NotSupportedException

    Always.

    | Improve this Doc View Source

    Join()

    Waits for the runner thread to complete all tasks in the queue, then exits.

    Declaration
    public void Join()
    Remarks

    After this method returns, this object has been disposed and is no longer in a valid state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    Thrown if this object has already been disposed.

    | Improve this Doc View Source

    QueueTask(Task)

    Queues a given System.Threading.Tasks.Task to this scheduler. The System.Threading.Tasks.Task must> be scheduled for this System.Threading.Tasks.TaskScheduler by the runtime.

    Declaration
    protected override void QueueTask(Task task)
    Parameters
    Type Name Description
    System.Threading.Tasks.Task task

    the System.Threading.Tasks.Task to queue

    Overrides
    System.Threading.Tasks.TaskScheduler.QueueTask(System.Threading.Tasks.Task)
    Exceptions
    Type Condition
    System.ObjectDisposedException

    Thrown if this object has already been disposed.

    | Improve this Doc View Source

    Start()

    Starts the thread that executes tasks scheduled with this System.Threading.Tasks.TaskScheduler

    Declaration
    public void Start()
    Exceptions
    Type Condition
    System.ObjectDisposedException

    Thrown if this object has already been disposed.

    | Improve this Doc View Source

    TryExecuteTaskInline(Task, Boolean)

    Rejects any attempts to execute a task inline.

    Declaration
    protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
    Parameters
    Type Name Description
    System.Threading.Tasks.Task task

    the task to attempt to execute

    System.Boolean taskWasPreviouslyQueued

    whether the task was previously queued to this scheduler

    Returns
    Type Description
    System.Boolean false
    Overrides
    System.Threading.Tasks.TaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, System.Boolean)
    Remarks

    This task scheduler always runs its tasks on the thread that it manages, therefore it doesn't make sense to run it inline.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    Thrown if this object has already been disposed.

    Implements

    System.IDisposable

    Extension Methods

    ReflectionUtil.SetField<T, U>(T, String, U)
    ReflectionUtil.GetField<U, T>(T, String)
    ReflectionUtil.SetProperty<T, U>(T, String, U)
    ReflectionUtil.GetProperty<U, T>(T, String)
    ReflectionUtil.InvokeMethod<U, T>(T, String, Object[])
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX