Icicle\Coroutine\Coroutine::cancel PHP Метод

cancel() публичный Метод

public cancel ( Throwable $reason = null )
$reason Throwable
    public function cancel(Throwable $reason = null)
    {
        if (!$this->isPending()) {
            return;
        }
        if (null === $reason) {
            $reason = new TerminatedException();
        }
        parent::cancel($reason);
        if ($this->current instanceof Awaitable) {
            $this->current->cancel($reason);
            // Will continue execution by throwing into the generator.
        }
    }

Usage Example

Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function dispose(Throwable $exception = null)
 {
     if (null === $exception) {
         $exception = new DisposedException('Observable disposed.');
     }
     $this->emitter = null;
     $this->queue->fail($exception);
     if (null !== $this->coroutine) {
         $this->coroutine->cancel($exception);
     }
 }
All Usage Examples Of Icicle\Coroutine\Coroutine::cancel