This has the same goal as D3877. The main differences are:
- It is integrated it the Future system. -> Repeating Tasks can be canceled and waited on. {every task has to end somewen it's nice to synchronise that}. Return values isn't implemented.
- There is no bound how long a task can take.
- There is no bound how frequent a task can occur.
- It's possible to have dynamic delays. That means the delays between invocations doesn't have to be set before the task is started. The return of the invocation will be used as the next delay. {this is required by the SoundManager}
- A scheduler can be specified. {useful for mocking and in future to express "only schedule on the gl / simulation thread"}
- The `TaskManager` part is more flexible. -> "Run this function in `2s` once" can be easily implemented. {That will be useful for networking}
The old `SharedState` and `PackagedTask` can't be used. I duplicated them. Moving some code to Receiver would be the better solution. That should be done first.
Also the TaskManager part is hacky (no thread will sleep when there is one delayed task waiting), but it was hacky before.