An abstract machine for asynchronous programs with closures and priority queues