-
Notifications
You must be signed in to change notification settings - Fork 0
Scheduler
Dive's scheduler is a fairly simple system that executes tasks after a specified amount of time.
The scheduler has the following properties. Some may affect the way you use it.
The scheduler may execute tasks any time after they expire. They won't always execute exactly at the time you have specified for them. This is mostly because the scheduler will try to limit how much time it takes up in the game loop.
They will never be executed before they expire.
The scheduler will always execute at least one task per update tick, such that task execution time cannot be completely starved by other processes, even if it means slowing down the game loop.
A task that was scheduled for 10 seconds ago will be executed before a task scheduled for 5 seconds ago.
Two tasks that have the same expiry time are not guaranteed to be executed in the same order every time.
To schedule a task, you must create a TaskInfo object.
The time before expiring and executing this task.
Whether or not this is a repeating task.
The delegate to call when the task expires.
Whether or not this task has been completed. This can also be set to remove the task from the scheduler.
The amount of time left until execution. This is set by the scheduler, and should not be changed.