[MINOR] task: keep a task count and clean up task creators

It's sometimes useful at least for statistics to keep a task count.
It's easy to do by forcing the rare task creators to always use the
same functions to create/destroy a task.
6 files changed