Convert TaskScheduler into class

Signed-off-by: Oleg Bulatov <oleg@bulatov.me>