diff options
Diffstat (limited to 'kotlinx-coroutines-core/jvm/src/channels/Actor.kt')
-rw-r--r-- | kotlinx-coroutines-core/jvm/src/channels/Actor.kt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/kotlinx-coroutines-core/jvm/src/channels/Actor.kt b/kotlinx-coroutines-core/jvm/src/channels/Actor.kt index 0212d740..96cda7b1 100644 --- a/kotlinx-coroutines-core/jvm/src/channels/Actor.kt +++ b/kotlinx-coroutines-core/jvm/src/channels/Actor.kt @@ -127,7 +127,11 @@ private open class ActorCoroutine<E>( parentContext: CoroutineContext, channel: Channel<E>, active: Boolean -) : ChannelCoroutine<E>(parentContext, channel, active), ActorScope<E> { +) : ChannelCoroutine<E>(parentContext, channel, initParentJob = false, active = active), ActorScope<E> { + + init { + initParentJob(parentContext[Job]) + } override fun onCancelling(cause: Throwable?) { _channel.cancel(cause?.let { @@ -159,11 +163,17 @@ private class LazyActorCoroutine<E>( return super.send(element) } + @Suppress("DEPRECATION_ERROR") override fun offer(element: E): Boolean { start() return super.offer(element) } + override fun trySend(element: E): ChannelResult<Unit> { + start() + return super.trySend(element) + } + override fun close(cause: Throwable?): Boolean { // close the channel _first_ val closed = super.close(cause) |