Skip to content

Instantly share code, notes, and snippets.

@myungpyo
Created June 2, 2022 08:33
Show Gist options
  • Save myungpyo/6364c3cb83619892cc8863809c5b02d4 to your computer and use it in GitHub Desktop.
Save myungpyo/6364c3cb83619892cc8863809c5b02d4 to your computer and use it in GitHub Desktop.
private fun cancelParent(cause: Throwable): Boolean {
if (isScopedCoroutine) return true
val isCancellation = cause is CancellationException
val parent = parentHandle
if (parent === null || parent === NonDisposableHandle) {
return isCancellation
}
return parent.childCancelled(cause) || isCancellation
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment