Files
kiri-http-server/Task/TaskInterface.php
T

45 lines
995 B
PHP
Raw Permalink Normal View History

2023-04-22 02:04:31 +08:00
<?php
namespace Kiri\Server\Task;
interface TaskInterface
{
2023-08-17 16:56:51 +08:00
/**
2025-07-11 14:44:06 +08:00
* @param string $handler
2025-07-11 11:50:54 +08:00
* @param mixed $data
* @param int $dstWorkerId
* @param callable|null $finishFinishCallback
* @return void
*/
2025-07-11 14:44:06 +08:00
public function task(string $handler, mixed $data, int $dstWorkerId = -1, ?callable $finishFinishCallback = null): void;
2025-07-11 11:50:54 +08:00
/**
2025-07-11 14:44:06 +08:00
* @param string $handler
2025-07-11 11:50:54 +08:00
* @param mixed $data
2023-08-17 16:56:51 +08:00
* @param float $timeout
2025-07-11 11:50:54 +08:00
* @param int $dstWorkerId
* @return mixed
2023-08-17 16:56:51 +08:00
*/
2025-07-11 14:44:06 +08:00
public function taskWait(string $handler, mixed $data, float $timeout = 0.5, int $dstWorkerId = -1): mixed;
2025-07-11 11:50:54 +08:00
2023-04-22 02:04:31 +08:00
2023-08-17 16:56:51 +08:00
/**
* @param array $tasks
* @param float $timeout
* @return false|array
*/
public function taskCo(array $tasks, float $timeout = 0.5): false|array;
2025-07-11 11:50:54 +08:00
2023-08-17 16:56:51 +08:00
/**
2025-07-11 11:50:54 +08:00
* @param array $tasks
2023-08-17 16:56:51 +08:00
* @param float $timeout
2025-07-11 11:50:54 +08:00
* @return false|array
2023-08-17 16:56:51 +08:00
*/
2025-07-11 11:50:54 +08:00
public function taskWaitMulti(array $tasks, float $timeout = 0.5): false|array;
2023-04-22 02:04:31 +08:00
}