groostav
08/01/2019, 7:31 PMDico
08/01/2019, 7:38 PMgroostav
08/01/2019, 7:40 PMsuspend () -> Unit, needless to say its coroutineContext can be greatly varied. Thus:
public fun myThing() = runBlocking {
val x: suspend () -> Unit = {
val context = coroutineContext //did you get the invoker of X's context or did you get the runBlocking's context?
}
}groostav
08/01/2019, 7:41 PMDico
08/01/2019, 7:44 PMgroostav
08/01/2019, 7:45 PMcurrentCoroutineContext or runningCoroutineContextgroostav
08/01/2019, 7:46 PMDico
08/01/2019, 7:48 PMsuspend inline fun getCoroutineContext() = suspendCoroutineUninterceptedOrReturn { cont -> cont.context }Dico
08/01/2019, 7:49 PMDico
08/01/2019, 7:50 PMgroostav
08/01/2019, 7:51 PMsuspendCoroutine { it.resume(it.context) } but yeah, even more simply I can create another inline global static function just to alias coroutineContext to something else.groostav
08/01/2019, 7:51 PMinline suspend fun currentCoroutineContext() = coroutineContextDico
08/01/2019, 7:51 PMDico
08/01/2019, 7:53 PMsuspend val became a thinggroostav
08/01/2019, 8:19 PMgroostav
08/01/2019, 8:22 PMsuspend val. When exactly is something too big to be a property? I donno, I've done a great deal of hand-wringing about suspend val.bdawg.io
08/02/2019, 6:33 PMbdawg.io
08/02/2019, 6:34 PMsuspend fun x() { val context = coroutineContext } above the myThing function?Dico
08/02/2019, 9:39 PM