Skip to content

How Job in coroutine works

Devrath edited this page Oct 8, 2021 · 16 revisions

Defining the coroutine job

  • 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 invokes join on Job-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.

States of Jobs

Clone this wiki locally