Skip to content

Commit

Permalink
~ Also fix the order of events in lazy actor
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov committed Feb 17, 2020
1 parent cd8a496 commit a7b25dd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kotlinx-coroutines-core/jvm/src/channels/Actor.kt
@@ -1,5 +1,5 @@
/*
* 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.
*/

package kotlinx.coroutines.channels
Expand Down Expand Up @@ -165,8 +165,11 @@ private class LazyActorCoroutine<E>(
}

override fun close(cause: Throwable?): Boolean {
// close the channel _first_
val closed = super.close(cause)
// then start the coroutine (it will promptly fail if it was not started yet)
start()
return super.close(cause)
return closed
}

override val onSend: SelectClause2<E, SendChannel<E>>
Expand Down

0 comments on commit a7b25dd

Please sign in to comment.