```class Test { val continuation = Continuatio...
# coroutines
e
Copy code
class Test {
    val continuation = Continuation<Unit>(EmptyCoroutineContext) {
    }

    suspend fun testFire() = suspendCoroutineUninterceptedOrReturn<Unit> { cont ->
        println(continuation)
        println(cont)
        println(continuation == cont)
    }
    fun testMain() {
        val action: suspend () -> (Unit) = {
            testFire()
        }
        action.startCoroutineUninterceptedOrReturn(continuation)
    }
}
Why does this not not print the same thing twice and then true? IK it's significantly stupid but it still wasn't what I was expecting. And more generally is there a way to (safely) inject some sort of identifier into a continuation that can be picked up later? I assume Context is the right thing to use but I don't want to like overwrite any other context like job.
n
Not sure exactly what you are looking to do, but it kinda sounds like the use case that
CoroutineContext
is designed for. You can create your own keys and elements and then “inject” them like a
CoroutineName
or
CoroutineDispatcher
.
2