Chills
01/26/2020, 3:05 PMlouiscad
01/26/2020, 3:17 PMChills
01/26/2020, 3:20 PMChills
01/26/2020, 3:20 PMDominaezzz
01/26/2020, 3:33 PMChills
01/26/2020, 3:45 PMstreetsofboston
01/26/2020, 3:55 PMHow does it handle multiple threadsCoroutines are more like async await (with Structured Concurrency). The fact that they run on threads, fibers, whatever, is somewhat immaterial. Code in a Coroutine is guaranteed to run sequentially, even if the continuation, after a suspending function resumes, is run on a different thread in the Dispatcher's thread pool (if threads are used).
streetsofboston
01/26/2020, 3:57 PMChills
01/26/2020, 3:59 PMChills
01/26/2020, 3:59 PMstreetsofboston
01/26/2020, 4:03 PMstreetsofboston
01/26/2020, 4:04 PMstreetsofboston
01/26/2020, 4:07 PMChills
01/26/2020, 4:13 PMDominaezzz
01/26/2020, 4:17 PMit only will be asynchronous, not concurrentAre you sure about this?
Dominaezzz
01/26/2020, 4:19 PMstreetsofboston
01/26/2020, 4:20 PMstreetsofboston
01/26/2020, 4:24 PMDominaezzz
01/26/2020, 4:31 PMvar number: Int = 5
coroutineScope {
repeat(2) {
launch {
val temp = number
val inc = suspendingHttpCallForInc(temp)
number = temp + inc
}
}
}
streetsofboston
01/26/2020, 5:09 PM