taponidhi
06/13/2021, 4:32 AMephemient
06/13/2021, 5:36 AMscope.launch(context)
, the child's scope has elements contributed by three sources: the parent's scope's context elements, the given context's elements, and the Job created by launchtaponidhi
06/13/2021, 5:45 AMephemient
06/13/2021, 5:47 AMtaponidhi
06/13/2021, 5:58 AMTwoClocks
06/16/2021, 11:10 PMsuspend {
println("from coroutine");
}.startCoroutine(
object : Continuation<Unit> {
override val context: CoroutineContext = EmptyCoroutineContext
// called when a coroutine ends. do nothing.
override fun resumeWith(result: Result<Unit>) {
result.onFailure { ex : Throwable -> throw ex }
}
}
)
ephemient
06/16/2021, 11:20 PMkotlin.coroutines.*
, yes. you'lll note that you can't launch
from inside there though, because CoroutineScope and the rest of kotlinx.coroutines.*
work together to support and enforce certain patterns of structured concurrencyTwoClocks
06/16/2021, 11:26 PMlaunch
at all. that's all nice-to-have helper functions. but you don't need any of that if you want to create/run/suspend coroutines.ephemient
06/16/2021, 11:28 PMTwoClocks
06/16/2021, 11:33 PMepoll
based event loop. You can't have people called dealy
that independ of the vent loop without havaing threading issues. I think rust has a better solution as it decoupled the progress of events from when/how/who wakes them up.frankelot
08/29/2021, 9:35 PMCoroutineContext
and we get rid of Scope
altoghether. It’s pretty confusing because it doesn’t even scope the coroutine (the Job
does that)… I find CoroutineScope
has a lot of overlap with other already defined structs in the libraryelizarov
08/30/2021, 7:48 AMfrankelot
08/31/2021, 12:07 PM