Add infrastructure to run a function asynchronously.