Skip to content

Commit a7b25dd

Browse files
committed
~ Also fix the order of events in lazy actor
1 parent cd8a496 commit a7b25dd

File tree

1 file changed

+5
-2
lines changed
  • kotlinx-coroutines-core/jvm/src/channels

1 file changed

+5
-2
lines changed

kotlinx-coroutines-core/jvm/src/channels/Actor.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.coroutines.channels
@@ -165,8 +165,11 @@ private class LazyActorCoroutine<E>(
165165
}
166166

167167
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)
168171
start()
169-
return super.close(cause)
172+
return closed
170173
}
171174

172175
override val onSend: SelectClause2<E, SendChannel<E>>

0 commit comments

Comments
 (0)