vineethraj49
11/20/2019, 4:12 PMwithContext ? (I’m trying to time some functions)vineethraj49
11/20/2019, 4:13 PMinvokeOnCompletion with async be a “good” ideaRory Armstrong
11/20/2019, 4:15 PMrunBlocking?Dominaezzz
11/20/2019, 4:17 PMsikri
11/20/2019, 4:21 PMsuspend fun someFun() = withContext(<http://Dispatcher.IO|Dispatcher.IO>) {
…
}sikri
11/20/2019, 4:22 PMcoroutineScope, please, use it, if you are able to call it from coroutine/suspend fun, as runBlocking is blocking, and coroutineScope is suspendingvineethraj49
11/20/2019, 4:23 PMwithContext takes a parameter `block`; that block’s completion;
think of it like
try {
block()
} finally {
method()
}Dominaezzz
11/20/2019, 4:24 PMDominaezzz
11/20/2019, 4:25 PMwithContext in try/finally, no?vineethraj49
11/20/2019, 4:26 PMvineethraj49
11/20/2019, 4:26 PM