eee
This commit is contained in:
+20
-5
@@ -7,17 +7,34 @@ use Kiri\Server\ServerInterface;
|
||||
class TaskExecute implements TaskInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param OnTaskInterface $handler
|
||||
* @param mixed $data
|
||||
* @param int $dstWorkerId
|
||||
* @param callable|null $finishFinishCallback
|
||||
* @return void
|
||||
*/
|
||||
public function task(OnTaskInterface $handler, mixed $data, int $dstWorkerId = -1, ?callable $finishFinishCallback = null): void
|
||||
{
|
||||
$server = \Kiri::getDi()->get(ServerInterface::class);
|
||||
|
||||
$server->task([$handler, $data], $dstWorkerId, $finishFinishCallback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param OnTaskInterface $handler
|
||||
* @param mixed $data
|
||||
* @param float $timeout
|
||||
* @param int $dstWorkerId
|
||||
* @return mixed
|
||||
*/
|
||||
public function taskWait(mixed $data, float $timeout = 0.5, int $dstWorkerId = -1): mixed
|
||||
public function taskWait(OnTaskInterface $handler, mixed $data, float $timeout = 0.5, int $dstWorkerId = -1): mixed
|
||||
{
|
||||
$server = \Kiri::getDi()->get(ServerInterface::class);
|
||||
|
||||
return $server->taskwait($data, $timeout, $dstWorkerId);
|
||||
return $server->taskwait([$handler, $data], $timeout, $dstWorkerId);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +62,4 @@ class TaskExecute implements TaskInterface
|
||||
|
||||
return $server->taskWaitMulti($tasks, $timeout);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user