Class SingleThreadTaskScheduler
A single-threaded task scheduler that runs all of its tasks on the same thread.
Implements
Inherited Members
Namespace: IPA.Utilities.Async
Assembly: IPA.Loader.dll
Syntax
public class SingleThreadTaskScheduler : TaskScheduler, IDisposable
Properties
| Improve this Doc View SourceIsRunning
Gets whether or not the underlying thread has been started.
Declaration
public bool IsRunning { get; }
Property Value
Type | Description |
---|---|
Boolean |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if this object has already been disposed. |
Methods
| Improve this Doc View SourceDispose()
Disposes this object. This puts the object into an unusable state.
Declaration
public void Dispose()
Dispose(Boolean)
Disposes this object.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | whether or not to dispose managed objects |
Exit()
Terminates the runner thread, and waits for the currently running task to complete.
Declaration
public IEnumerable<Task> Exit()
Returns
Type | Description |
---|---|
IEnumerable<Task> | an IEnumerable<T> of 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 |
---|---|
InvalidOperationException | Thrown if this object has already been disposed. |
GetScheduledTasks()
Throws a NotSupportedException.
Declaration
protected override IEnumerable<Task> GetScheduledTasks()
Returns
Type | Description |
---|---|
IEnumerable<Task> | nothing |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | Always. |
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 |
---|---|
InvalidOperationException | Thrown if this object has already been disposed. |
QueueTask(Task)
Queues a given Task to this scheduler. The Task must> be scheduled for this TaskScheduler by the runtime.
Declaration
protected override void QueueTask(Task task)
Parameters
Type | Name | Description |
---|---|---|
Task | task | the Task to queue |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if this object has already been disposed. |
Start()
Starts the thread that executes tasks scheduled with this TaskScheduler
Declaration
public void Start()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if this object has already been disposed. |
TryExecuteTaskInline(Task, Boolean)
Rejects any attempts to execute a task inline.
Declaration
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
Parameters
Type | Name | Description |
---|---|---|
Task | task | the task to attempt to execute |
Boolean | taskWasPreviouslyQueued | whether the task was previously queued to this scheduler |
Returns
Type | Description |
---|---|
Boolean | false |
Overrides
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 |
---|---|
InvalidOperationException | Thrown if this object has already been disposed. |