Dalinar
02/04/2019, 11:52 AMGlobalScope
in `GlobalScope.async { }`but without using coroutineScope { }
- I mean I want to write x.async{ }
- how do I do that? what should x
be? to make it the equivalant of doing coroutineScope { }
? is this possible? the reason I ask is because it requires a lot of reworking to use coroutineScope { }
for this section of codegildor
02/04/2019, 12:05 PMI want to replace theWhat do you mean? coroutineScope has very different semantics and use casein `GlobalScope.async { }`but without usingGlobalScope
coroutineScope { }
I mean I want to writeIt should be some CoroutineScope.- how do I do that? what shouldx.async{ }
be?x
Dalinar
02/04/2019, 12:06 PMcoroutineScope { }
construct ?gildor
02/04/2019, 12:06 PMDalinar
02/04/2019, 12:07 PMgildor
02/04/2019, 12:07 PMx.async{}
?Dalinar
02/04/2019, 12:07 PMval f: Deferred<Status> = abc.deferredClose ?: let {
val g = GlobalScope.async { foo(abc) }
abc.deferredClose = g
g
}
gildor
02/04/2019, 12:21 PMDalinar
02/04/2019, 12:22 PMgildor
02/04/2019, 12:22 PMf
should implement CoroutineScope and you should control it lifecycle (otherwise you leaking coroutine)Dalinar
02/04/2019, 12:24 PM