This commit is contained in:
2023-08-17 17:04:55 +08:00
parent b26d5074fc
commit 5150b9027e
3 changed files with 56 additions and 45 deletions
+54
View File
@@ -0,0 +1,54 @@
<?php
namespace Kiri\Server\Task;
use Kiri\Di\Inject\Container;
use Kiri\Server\ServerInterface;
class TaskExecute implements TaskInterface
{
/**
* @var ServerInterface
*/
#[Container(ServerInterface::class)]
public ServerInterface $server;
/**
* @param mixed $data
* @param float $timeout
* @param int $dstWorkerId
* @return mixed
*/
public function taskWait(mixed $data, float $timeout = 0.5, int $dstWorkerId = -1): mixed
{
return $this->server->taskwait($data, $timeout, $dstWorkerId);
}
/**
* @param array $tasks
* @param float $timeout
* @return false|array
*/
public function taskCo(array $tasks, float $timeout = 0.5): false|array
{
return $this->server->taskCo($tasks, $timeout);
}
/**
* @param array $tasks
* @param float $timeout
* @return false|array
*/
public function taskWaitMulti(array $tasks, float $timeout = 0.5): false|array
{
return $this->server->taskWaitMulti($tasks, $timeout);
}
}