2023-08-17 17:04:55 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Kiri\Server\Task;
|
|
|
|
|
|
|
|
|
|
use Kiri\Server\ServerInterface;
|
|
|
|
|
|
|
|
|
|
class TaskExecute implements TaskInterface
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mixed $data
|
|
|
|
|
* @param float $timeout
|
|
|
|
|
* @param int $dstWorkerId
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function taskWait(mixed $data, float $timeout = 0.5, int $dstWorkerId = -1): mixed
|
|
|
|
|
{
|
2024-08-29 17:01:07 +08:00
|
|
|
$server = \Kiri::getDi()->get(ServerInterface::class);
|
|
|
|
|
|
|
|
|
|
return $server->taskwait($data, $timeout, $dstWorkerId);
|
2023-08-17 17:04:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param array $tasks
|
|
|
|
|
* @param float $timeout
|
|
|
|
|
* @return false|array
|
|
|
|
|
*/
|
|
|
|
|
public function taskCo(array $tasks, float $timeout = 0.5): false|array
|
|
|
|
|
{
|
2024-08-29 17:01:07 +08:00
|
|
|
$server = \Kiri::getDi()->get(ServerInterface::class);
|
|
|
|
|
|
|
|
|
|
return $server->taskCo($tasks, $timeout);
|
2023-08-17 17:04:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param array $tasks
|
|
|
|
|
* @param float $timeout
|
|
|
|
|
* @return false|array
|
|
|
|
|
*/
|
|
|
|
|
public function taskWaitMulti(array $tasks, float $timeout = 0.5): false|array
|
|
|
|
|
{
|
2024-08-29 17:01:07 +08:00
|
|
|
$server = \Kiri::getDi()->get(ServerInterface::class);
|
|
|
|
|
|
|
|
|
|
return $server->taskWaitMulti($tasks, $timeout);
|
2023-08-17 17:04:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|