TaskSet::dispose
(PHP 8.6+, True Async 1.0)
public TaskSet::dispose(): void
Destroys the set scope, cancelling all coroutines. After calling this, the set is completely unusable.
Examples
Example #1 Destroying a set
<?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