Files
kiri-core/kiri-engine/Coordinator.php
T

45 lines
455 B
PHP
Raw Normal View History

2022-06-17 11:59:19 +08:00
<?php
2023-04-16 01:45:34 +08:00
declare(strict_types=1);
2022-06-17 11:59:19 +08:00
namespace Kiri;
class Coordinator
{
2023-12-12 15:35:38 +08:00
const string WORKER_START = 'worker:start';
2022-06-17 11:59:19 +08:00
2024-11-15 14:24:19 +08:00
private bool $waite = true;
2022-06-17 11:59:19 +08:00
/**
* @return void
*/
public function yield(): void
{
2024-11-15 14:30:18 +08:00
while ($this->waite) {
usleep(1000);
}
2022-06-17 11:59:19 +08:00
}
/**
* @return void
*/
public function waite(): void
{
$this->waite = true;
}
/**
* @return void
*/
public function done(): void
{
$this->waite = false;
}
}