Resumable Job
A resumable job can be started in one worker and can be resumed in the original caller worker. For example, an API call can be started in a background worker but its results can be delivered on the main thread. The resumed job is a closure which takes the output of the original job as input. The caller does not need to wait for the background worker to complete just like co-routines as the resuming job is added to the event loop of the caller thread.
Note: This is an attempt to close the gap until multi-threaded coroutines become available on both platforms.
Parameters
Types
Functions
Properties
whether target worker should wait for the resumed job closure to complete. It is useful in testing.
the non capturing closure which will execute on the target worker.
the non capturing closure which runs on the caller thread and accepts the job
output as the only argument.
the worker on which the job should be resumed once the target worker is finished.