47 lines
804 B
PHP
47 lines
804 B
PHP
<?php
|
|
|
|
namespace Kiri\Actor;
|
|
|
|
use Kiri\Server\Processes\AbstractProcess;
|
|
use Swoole\Coroutine;
|
|
use Swoole\Process;
|
|
|
|
class ActorProcess extends AbstractProcess
|
|
{
|
|
|
|
/**
|
|
* @var bool
|
|
*/
|
|
protected bool $enable_coroutine = true;
|
|
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getName(): string
|
|
{
|
|
// TODO: Change the autogenerated stub
|
|
return 'Actor Manager';
|
|
}
|
|
|
|
|
|
public function process(?Process $process): void
|
|
{
|
|
// TODO: Implement process() method.
|
|
while ($this->isStop() === false) {
|
|
$read = $process->read();
|
|
|
|
ActorManager::exec(json_decode($read, true));
|
|
|
|
Coroutine::sleep(1000 / 120);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function onSigterm(): void
|
|
{
|
|
}
|
|
} |