Created
January 30, 2021 18:14
-
-
Save GauravChaddha1996/2a1a3923113f7bf61844c41ce3bade80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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