We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cd8a496 commit a7b25ddCopy full SHA for a7b25dd
kotlinx-coroutines-core/jvm/src/channels/Actor.kt
@@ -1,5 +1,5 @@
1
/*
2
- * Copyright 2016-2018 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.
3
*/
4
5
package kotlinx.coroutines.channels
@@ -165,8 +165,11 @@ private class LazyActorCoroutine<E>(
165
}
166
167
override fun close(cause: Throwable?): Boolean {
168
+ // close the channel _first_
169
+ val closed = super.close(cause)
170
+ // then start the coroutine (it will promptly fail if it was not started yet)
171
start()
- return super.close(cause)
172
+ return closed
173
174
175
override val onSend: SelectClause2<E, SendChannel<E>>
0 commit comments