Revamp scheduler and timers

The scheduler has its own thread pool where timers are added, instead
of using the main event loop.

Task adding function signatures have changed slighlty to support removal.