Class TaskScheduler
Handles scheduling and distributing task execution between frames, attempting to balance frame-by-frame execution so one frame isn't heavier than the another.
Inheritance
Implements
Namespace: Atlas
Assembly: Atlas.Runtime.dll
Syntax
public sealed class TaskScheduler : IScheduledTask
Constructors
| Improve this Doc View SourceTaskScheduler(Int32)
Constructor
Declaration
public TaskScheduler(int phaseIterationCount = 10)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | phaseIterationCount | Number of frames to look ahead at when determining the optimum phase for a task |
Properties
| Improve this Doc View SourceFrame
This scheduler's current frame count
Declaration
public int Frame { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TaskCount
Number of tasks currently scheduled to execute
Declaration
public int TaskCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceAddTask(IScheduledTask, UInt32)
Registers the given task for scheduled updates, with an automatic phase assignment.
This method will be a bit slower than AddTask(IScheduledTask, UInt32, Int32), as it will evaluate the number of
scheduled tasks for upcoming frames in an attempt to select an optimum phase offset for the given task
.
Declaration
public void AddTask(IScheduledTask task, uint frequency)
Parameters
Type | Name | Description |
---|---|---|
IScheduledTask | task | The task to schedule |
System.UInt32 | frequency | The desired update frequency (in frames) |
AddTask(IScheduledTask, UInt32, Int32)
Registers the given task for scheduled updates
Declaration
public void AddTask(IScheduledTask task, uint frequency, int phase)
Parameters
Type | Name | Description |
---|---|---|
IScheduledTask | task | The task to schedule |
System.UInt32 | frequency | The desired update frequency (in frames) |
System.Int32 | phase | An offset used to scatter tasks with similar frequencies |
ChangeFrequency(IScheduledTask, UInt32)
Changes the frequency for a task that is already managed by this scheduler
Declaration
public void ChangeFrequency(IScheduledTask task, uint frequency)
Parameters
Type | Name | Description |
---|---|---|
IScheduledTask | task | The task to update |
System.UInt32 | frequency | The task's desired frequency |
RemoveTask(IScheduledTask)
Unregisters the given task
Declaration
public void RemoveTask(IScheduledTask task)
Parameters
Type | Name | Description |
---|---|---|
IScheduledTask | task | The task to remove |
ScheduledTick()
Updates the scheduler, and any tasks scheduled to execute on the scheduler's current Frame
Declaration
public void ScheduledTick()