PocketMine-MP
PocketMine-MP copied to clipboard
Real time scheduler
Description
A scheduler that allows scheduling tasks using real time units instead of ticks.
Justification
Tick scheduler is subject to server TPS change. While tick scheduling may be desirable for simple async deferment, scheduling more than a few ticks most often implies user wants to schedule using real time instead.
Alternative methods
Real time scheduling can be emulated by a repeating task at a smaller frequency that checks if current real time has reached the desired timeout, but this means every tick would be O(n) where n is the number of scheduled real time tasks. A specialized heap for scheduling real time tasks avoids this unnecessary overhead.