Icicle\Concurrent\Worker\Worker::enqueue PHP Method

enqueue() public method

public enqueue ( Icicle\Concurrent\Worker\Task $task ) : Generator
$task Icicle\Concurrent\Worker\Task The task to enqueue.
return Generator
    public function enqueue(Task $task) : \Generator;

Usage Example

示例#1
0
 /**
  * @param string $operation
  * @param int $value
  *
  * @return \Generator
  *
  * @throws \Icicle\File\Exception\FileException
  */
 private function change(string $operation, int $value) : \Generator
 {
     if (!$this->isOpen()) {
         throw new FileException('The file has been closed.');
     }
     try {
         return yield from $this->worker->enqueue(new Internal\FileTask($operation, [$this->path, $value]));
     } catch (TaskException $exception) {
         $this->close();
         throw new FileException(sprintf('%s failed.', $operation), $exception);
     }
 }
All Usage Examples Of Icicle\Concurrent\Worker\Worker::enqueue