Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* @return a job to represent the coroutine for 'T'
* */
fun taskT(): Job {
* Starting task 'T' by launching coroutine 'C'
* Task name: T
* Coroutine name: C
* Thread pool: IO is used since we do network calls etc.
* Scope: We use global scope since the operation is to be
completed even if the page closes.
* Builder explanation: launch builder is used since it is a
fire and forget task the calling page doesn't care about
it's result.
* suspension: No this won't block the main thread but simply
start 'C'.
* We return the representative job.
* */
return GlobalScope.launch(Dispatchers.IO) {
// Logic binding code for t1, t2, t3, t4 and
// t5 is omitted here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment