File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
core/kotlinx-coroutines-io/src/main/kotlin/kotlinx/coroutines/experimental/io Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ internal class ByteBufferChannel(
95
95
return true
96
96
}
97
97
98
+ suspend override fun cancel (cause : Throwable ? ): Boolean {
99
+ return close(cause ? : CancellationException (" Channel has been cancelled" ))
100
+ }
101
+
98
102
private fun flushImpl (minReadSize : Int , minWriteSize : Int ) {
99
103
joining?.delegatedTo?.flush()
100
104
Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ public interface ByteReadChannel {
144
144
* @param block to be invoked when at least [min] bytes available for read
145
145
*/
146
146
suspend fun read (min : Int = 1, block : (ByteBuffer ) -> Unit )
147
+
148
+ suspend fun cancel (cause : Throwable ? ): Boolean
147
149
}
148
150
149
151
suspend fun ByteReadChannel.joinTo (dst : ByteWriteChannel , closeOnEnd : Boolean ) {
You can’t perform that action at this time.
0 commit comments