timrijckaert
11/13/2018, 4:49 PMsuspend fun CoroutineScope.foo() : ReceiveChannel<List<Int>> =
produce {
launch {
val cache = cache.getCachedInts()
offer(cache)
}
launch {
val network = network.getNetworkInts
if (network.isNotEmty()) {
cache.cacheInts(network)
}
offer(network)
}
}
I tried runBlocking
but it seems unavaible in MPP?gildor
11/13/2018, 5:04 PMmersan
11/13/2018, 5:07 PMDispatchers.Unconfined
to run it on the current thread.timrijckaert
11/13/2018, 5:18 PMGlobalScope.launch(Dispatchers.Unconfined) {
...
}
mersan
11/13/2018, 8:56 PM