TaskScheduler
in package
Table of Contents
- $currentTick : int
- $queue : ReversePriorityQueue
- $tasks : ObjectSet|array<string|int, TaskHandler>
- $enabled : bool
- $owner : string|null
- __construct() : mixed
- cancelAllTasks() : void
- isQueued() : bool
- mainThreadHeartbeat() : void
- scheduleDelayedRepeatingTask() : TaskHandler
- scheduleDelayedTask() : TaskHandler
- scheduleRepeatingTask() : TaskHandler
- scheduleTask() : TaskHandler
- setEnabled() : void
- shutdown() : void
- addTask() : TaskHandler
- handle() : TaskHandler
- isReady() : bool
Properties
$currentTick
protected
int
$currentTick
= 0
$queue
protected
ReversePriorityQueue
$queue
Tags
$tasks
protected
ObjectSet|array<string|int, TaskHandler>
$tasks
Tags
$enabled
private
bool
$enabled
= true
$owner
private
string|null
$owner
Methods
__construct()
public
__construct([string|null $owner = null ]) : mixed
Parameters
- $owner : string|null = null
Return values
mixed —cancelAllTasks()
public
cancelAllTasks() : void
Return values
void —isQueued()
public
isQueued(TaskHandler $task) : bool
Parameters
- $task : TaskHandler
Return values
bool —mainThreadHeartbeat()
public
mainThreadHeartbeat(int $currentTick) : void
Parameters
- $currentTick : int
Return values
void —scheduleDelayedRepeatingTask()
public
scheduleDelayedRepeatingTask(Task $task, int $delay, int $period) : TaskHandler
Parameters
- $task : Task
- $delay : int
- $period : int
Return values
TaskHandler —scheduleDelayedTask()
public
scheduleDelayedTask(Task $task, int $delay) : TaskHandler
Parameters
- $task : Task
- $delay : int
Return values
TaskHandler —scheduleRepeatingTask()
public
scheduleRepeatingTask(Task $task, int $period) : TaskHandler
Parameters
- $task : Task
- $period : int
Return values
TaskHandler —scheduleTask()
public
scheduleTask(Task $task) : TaskHandler
Parameters
- $task : Task
Return values
TaskHandler —setEnabled()
public
setEnabled(bool $enabled) : void
Parameters
- $enabled : bool
Return values
void —shutdown()
public
shutdown() : void
Return values
void —addTask()
private
addTask(Task $task, int $delay, int $period) : TaskHandler
Parameters
- $task : Task
- $delay : int
- $period : int
Return values
TaskHandler —handle()
private
handle(TaskHandler $handler) : TaskHandler
Parameters
- $handler : TaskHandler
Return values
TaskHandler —isReady()
private
isReady(int $currentTick) : bool
Parameters
- $currentTick : int