aboutsummaryrefslogtreecommitdiff
path: root/kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt
diff options
context:
space:
mode:
Diffstat (limited to 'kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt')
-rw-r--r--kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt25
1 files changed, 2 insertions, 23 deletions
diff --git a/kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt b/kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt
index 9721583e..8edd2b31 100644
--- a/kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt
+++ b/kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.coroutines.channels
@@ -477,14 +477,7 @@ internal abstract class AbstractSendChannel<E>(
override val pollResult: Any? get() = element
override fun tryResumeSend(otherOp: PrepareOp?): Symbol? = RESUME_TOKEN.also { otherOp?.finishPrepare() }
override fun completeResumeSend() {}
-
- /**
- * This method should be never called, see special logic in [LinkedListChannel.onCancelIdempotentList].
- */
- override fun resumeSendClosed(closed: Closed<*>) {
- assert { false }
- }
-
+ override fun resumeSendClosed(closed: Closed<*>) {}
override fun toString(): String = "SendBuffered@$hexAddress($element)"
}
}
@@ -642,13 +635,6 @@ internal abstract class AbstractChannel<E>(
cancelInternal(cause)
final override fun cancel(cause: CancellationException?) {
- /*
- * Do not create an exception if channel is already cancelled.
- * Channel is closed for receive when either it is cancelled (then we are free to bail out)
- * or was closed and elements were received.
- * Then `onCancelIdempotent` does nothing for all implementations.
- */
- if (isClosedForReceive) return
cancelInternal(cause ?: CancellationException("$classSimpleName was cancelled"))
}
@@ -682,13 +668,6 @@ internal abstract class AbstractChannel<E>(
// Add to the list only **after** successful removal
list += previous as Send
}
- onCancelIdempotentList(list, closed)
- }
-
- /**
- * This method is overridden by [LinkedListChannel] to handle cancellation of [SendBuffered] elements from the list.
- */
- protected open fun onCancelIdempotentList(list: InlineList<Send>, closed: Closed<*>) {
list.forEachReversed { it.resumeSendClosed(closed) }
}