Class BackgroundTaskScheduler
An implementation of TaskScheduler that uses a Evergine background thread to execute tasks.
Inherited Members
Namespace: Evergine.Framework.Threading
Assembly: Evergine.Framework.dll
Syntax
public class BackgroundTaskScheduler : TaskScheduler
Properties
Background
Gets the instance of BackgroundTaskScheduler.
Declaration
public static BackgroundTaskScheduler Background { get; }
Property Value
Type | Description |
---|---|
BackgroundTaskScheduler |
Methods
Configure(Container)
Configures the ForegroundTaskScheduler and starts the background thread.
Declaration
public void Configure(Container container)
Parameters
Type | Name | Description |
---|---|---|
Container | container | The application container that have registered the Evergine services. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The scheduler can be configured once. |
GetScheduledTasks()
Generates an enumerable of Task instances currently queued to the scheduler waiting to be executed.
Declaration
protected override IEnumerable<Task> GetScheduledTasks()
Returns
Type | Description |
---|---|
IEnumerable<Task> | An enumerable that allows traversal of tasks currently queued to this scheduler. |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | This scheduler is unable to generate a list of queued tasks at this time. |
QueueTask(Task)
Queues a Task to the scheduler.
Declaration
protected override void QueueTask(Task task)
Parameters
Type | Name | Description |
---|---|---|
Task | task | The Task to be queued. |
Overrides
TryExecuteTaskInline(Task, bool)
Determines whether the provided Task can be executed synchronously in this call, and if it can, executes it.
Declaration
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
Parameters
Type | Name | Description |
---|---|---|
Task | task | The Task to be executed. |
bool | taskWasPreviouslyQueued | A Boolean denoting whether or not task has previously been queued. If this parameter is True, then the task may have been previously queued (scheduled); if False, then the task is known not to have been queued, and this call is being made in order to execute the task inline without queuing it. |
Returns
Type | Description |
---|---|
bool | A Boolean value indicating whether the task was executed inline. |