TaskSet::dispose
(PHP 8.6+, True Async 1.0)
php
public TaskSet::dispose(): voidDestroys the set scope, cancelling all coroutines. After calling this, the set is completely unusable.
Examples
Example #1 Destroying a set
php
<?php
use Async\TaskSet;
spawn(function() {
$set = new TaskSet();
$set->spawn(fn() => longRunningTask());
$set->dispose();
});See Also
- TaskSet::cancel — Cancel tasks
- TaskSet::seal — Seal the set