July 2018
Intermediate to advanced
266 pages
7h 11m
English
A job in the state new can be started in many ways, but commonly it will be done by calling start() or join(), the difference being that the former will start the job without waiting for it to complete, whereas the latter will suspend execution until the job completes. Take this example into consideration:
fun main(args: Array<String>) { val job = launch(start = CoroutineStart.LAZY) { delay(3000) } job.start()}
The mentioned code will not suspend execution when job.start() is invoked, so the application will complete its execution without waiting for job to complete.
If we ...
Read now
Unlock full access