Fiber::isRunning 不返回值
示例
-------
<?php
$fiber = new Fiber(function (): void {
$value = Fiber::suspend('suspend');
echo "协程已恢复,值为: ", $value, "\n";
});
echo "协程尚未启动.", "\n";
$value = $fiber->start();
echo "协程已启动: ", $fiber->isStarted(), "\n";
echo "协程已挂起: ", $fiber->isSuspended(), "\n";
echo "协程正在运行: ", $fiber->isRunning(), "\n";
echo "协程已挂起,值为: ", $value, "\n";
$fiber->resume('resume');
echo "协程正在运行: ", $fiber->isRunning(), "\n";
?>
输出
---
协程尚未启动. 协程已启动: 1 协程已挂起: 1 协程正在运行: 协程已挂起,值为: suspend 协程已恢复,值为: resume 协程正在运行