Scope::isCancelled

(PHP 8.6+, True Async 1.0)

public function isCancelled(): bool

Checks whether the scope has been cancelled. A scope is marked as cancelled after a call to cancel() or dispose().

Return Value

booltrue if the scope has been cancelled, false otherwise.

Examples

Example #1 Checking scope cancellation

<?php

use Async\Scope;

$scope = new Scope();

var_dump($scope->isCancelled()); // bool(false)

$scope->cancel();

var_dump($scope->isCancelled()); // bool(true)

See Also