Robert Menke
10/16/2018, 3:32 PMcancel
method. I’m working on creating a class that implements CoroutineScope
and I’m following the example here https://github.com/Kotlin/kotlinx.coroutines/blob/master/core/kotlinx-coroutines-core/test/guide/example-context-10.kt.
I would expect that job.cancel()
would return true in this case since the invocation of cancel is what cancels the job, however, when I print the result of job.cancel()
I get false.
fun destroy() {
val temp = job.cancel()
print(temp.toString()) //prints "false" even though I would expect it to print "true"
}
Am I misunderstanding cancel?elizarov
10/16/2018, 3:39 PMcancel
on Job()
always returns false
at them moment. It might change.Robert Menke
10/16/2018, 3:41 PMelizarov
10/16/2018, 4:09 PMDerek Seroky
10/16/2018, 4:19 PM