From 20a025fc364d2ae77da3cf2d1898fa9aff5e9eb8 Mon Sep 17 00:00:00 2001 From: phuvh Date: Thu, 30 Jun 2022 13:42:49 +0700 Subject: [PATCH] =?UTF-8?q?#xo=C3=A1=20import=20v=C3=A0=20th=C3=AAm=20v?= =?UTF-8?q?=C3=AD=20d=E1=BB=A5=20stop=20parent=20s=E1=BA=BD=20stop=20child?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/magicghostvu/actor/Behavior.kt | 1 - src/main/kotlin/org/magicghostvu/actor/Behaviors.kt | 4 ++-- src/main/kotlin/org/magicghostvu/run/RunActor.kt | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/org/magicghostvu/actor/Behavior.kt b/src/main/kotlin/org/magicghostvu/actor/Behavior.kt index 5d83550..aad02bd 100644 --- a/src/main/kotlin/org/magicghostvu/actor/Behavior.kt +++ b/src/main/kotlin/org/magicghostvu/actor/Behavior.kt @@ -1,6 +1,5 @@ package org.magicghostvu.actor -import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ObsoleteCoroutinesApi import kotlinx.coroutines.channels.ActorScope import kotlinx.coroutines.channels.SendChannel diff --git a/src/main/kotlin/org/magicghostvu/actor/Behaviors.kt b/src/main/kotlin/org/magicghostvu/actor/Behaviors.kt index ccb3b63..0e8db11 100644 --- a/src/main/kotlin/org/magicghostvu/actor/Behaviors.kt +++ b/src/main/kotlin/org/magicghostvu/actor/Behaviors.kt @@ -176,8 +176,8 @@ object Behaviors { return MActorRef(internalChannel as SendChannel) } - - fun CoroutineScope.spawnChild( + @OptIn(ObsoleteCoroutinesApi::class) + fun ActorScope.spawnChild( debug: Boolean = false, factory: suspend () -> Behavior ): MActorRef { diff --git a/src/main/kotlin/org/magicghostvu/run/RunActor.kt b/src/main/kotlin/org/magicghostvu/run/RunActor.kt index efb8643..64a2b31 100644 --- a/src/main/kotlin/org/magicghostvu/run/RunActor.kt +++ b/src/main/kotlin/org/magicghostvu/run/RunActor.kt @@ -124,8 +124,8 @@ fun main(arr: Array) { } parent.tell(Msg1()) - /*delay(5000) - parent.tell(Msg4())*/ + delay(5000) + parent.tell(Msg4()) } } \ No newline at end of file