TaskSet::isClosed

(PHP 8.6+, True Async 1.0)

php
public TaskSet::isClosed(): bool

Returns true if the set is closed (close() or cancel() was called).

Return Value

true if the set is closed. false otherwise.

Examples

Example #1 Checking state

php
<?php

use Async\TaskSet;

spawn(function() {
    $set = new TaskSet();

    echo $set->isClosed() ? "yes\n" : "no\n"; // "no"

    $set->close();
    echo $set->isClosed() ? "yes\n" : "no\n"; // "yes"
});

See Also