Swoole Server taskwait

public void Swoole\Server::taskwait ( string $data [, float $timeout [, integer $worker_id ]] )

Alias: Swoole\Server->taskwait( string $data [, float $timeout [, integer $worker_id ]] )

The Swoole\Server->taskwait is similar to Swoole\Server->task. The two methods both send task data to the task worker pool to execute, but the former is blocking.

Parameter

  • $task_data the data which is to send to the task worker, its type could any type except fot resource
  • $timeout the time of timeout
  • $dst_worker_id the id number of task worker. If this parameter hasn't been passed, the swoole server would select a random and unoccupied task worker process.

Return

If the call of this method succeeds, the return is the result of task If the execution of this method exceeds the time of timeout, the return is false

Example