https://kotlinlang.org logo
#coroutines
Title
# coroutines
w

winteryoung

07/26/2018, 1:03 PM
This is an excerpt from Mutex.kt. I think
cont.initCancellability()
should be placed after
removeXXX
. Because if the coroutine was cancelled right after the init call, the waiter won't be removed.
e

elizarov

07/26/2018, 1:05 PM
removeOnCancellation
immediately removes the node if it is invoked on a continuation that is already cancelled.
w

winteryoung

07/26/2018, 1:17 PM
So, it seems it doesn't matter when to invoke
initCancellability
.
e

elizarov

07/26/2018, 1:20 PM
Correct. It does not matter
w

winteryoung

07/26/2018, 1:20 PM
thx
3 Views