clue
mentioned this pull request
Closed
This was referenced
Feb 16, 2022Merged
Merged
Closed
WyriHaximus
changed the title
[EXPIRIMENTAL] Cancel fiber
Improve async() by making its promises cancelable
clue
changed the title
Improve
Improve async() by making its promises cancelableasync() by making its promises cancellable
Since `async()` returns a promise and those are normally cancelable, implementing this puts them in line with the rest of our ecosystem. As such the following example will throw a timeout exception from the canceled `sleep()` call.
```php
$promise = async(static function (): int {
echo 'a';
await(sleep(2));
echo 'b';
return time();
})();
$promise->cancel();
await($promise);
````
This builds on top of reactphp#15, reactphp#18, reactphp#19, reactphp#26, reactphp#28, reactphp#30, and reactphp#32.
clue approved these changes Mar 4, 2022
clue
mentioned this pull request
Merged
clue
mentioned this pull request
Closed
clue
mentioned this pull request
Merged
clue
mentioned this pull request
Merged
clue
mentioned this pull request
Merged