Background jobs

Some TODO and probably bugs still in here, but I think this is an OK stopping point that should unblock activator to experiment with it.

this is the now-private version that does not assume threads or interrupts. We could put it back in the public API.