Background jobs

This changeset introduces an abstraction for (maintenance) jobs running in the background, of which execution may be triggered from other threads. SubscriptionManager could very well use this, but I haven't made it do so yet.

@xor-freenet Unit tests are not complete, I'll be finishing those tomorrow. I'm filing this pull request early so you can have a look at it already.
What about the ticker if state == WAITING? It will have the job queued on its own internal queue. You might want to shut it down as well.
(I know that the job won't actually be able to run afterwards because jobStarted() will return false if state == TERMINATED, but its still sort of a leak to keep it queued on the ticker)