变更
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace Kiri\Actor;
|
namespace Kiri\Actor;
|
||||||
|
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
use Swoole\Coroutine;
|
||||||
use Swoole\Coroutine\Channel;
|
use Swoole\Coroutine\Channel;
|
||||||
|
|
||||||
abstract class Actor implements ActorInterface, JsonSerializable
|
abstract class Actor implements ActorInterface, JsonSerializable
|
||||||
@@ -85,7 +86,11 @@ abstract class Actor implements ActorInterface, JsonSerializable
|
|||||||
*/
|
*/
|
||||||
public static function newActor($id): static
|
public static function newActor($id): static
|
||||||
{
|
{
|
||||||
return new static($id);
|
$actor = new static($id);
|
||||||
|
Coroutine::create(function (Actor $actor) {
|
||||||
|
$actor->run();
|
||||||
|
}, $actor);
|
||||||
|
return $actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user