This has the same goal as D3877. The interface 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 (see revision 21513). 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}
- Multiple delayed tasks might run in paralel.
The old `SharedState` and `PackagedTask` can't be used. I implemented similar types (there is some duplicate code). Some code should be moved to (the common) Receiver. That can be done before this diff.
Also the `WorkerThread` wakeup is hacky, but it was hacky before.