This commit is contained in:
2022-10-11 15:27:48 +08:00
parent 45aa4c5d92
commit 7824a7cc7a
+10
View File
@@ -70,6 +70,15 @@ abstract class Actor implements ActorInterface, JsonSerializable
} }
/**
* @return void
*/
public function init(): void
{
}
/** /**
* @param $id * @param $id
* @return static * @return static
@@ -115,6 +124,7 @@ abstract class Actor implements ActorInterface, JsonSerializable
public function run(): void public function run(): void
{ {
$this->setState(ActorState::BUSY); $this->setState(ActorState::BUSY);
$this->init();
$this->loop(); $this->loop();
$this->setState(ActorState::IDLE); $this->setState(ActorState::IDLE);
} }