-
Notifications
You must be signed in to change notification settings - Fork 24
How Job in coroutine works
Devrath edited this page Oct 8, 2021
·
16 revisions
- A coroutine returns a Job
- Using the Job we can create control the coroutine like stopping it, So a Job on a coroutine is a handle to the coroutine.
- More flexibility can be achieved using jobs, we can combine the instances of jobs using
join()
. - Say
Job-A
invokesjoin
onJob-B
the former won't be executed until later has finished on execution. - We can also set up a parent and child relation using which we can ensure parent wont complete until child has completed its execution.