ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## Coroutine::resume 恢复某个协程,使其继续运行。 ~~~ function Swoole\Coroutine::resume(int $coroutineId); ~~~ * 参数`$coroutineId`为要恢复的协程`ID`,在协程内可以使用`Coroutine::getUid`获取到协程的`ID` * 当前协程处于挂起状态时,另外的协程中可以使用`resume`再次唤醒当前协程 <br> ## 实例 ~~~ use Swoole\Coroutine as co; $id = go(function(){ $id = co::getUid(); echo "start coro $id\n"; co::suspend(); echo "resume coro $id @1\n"; co::suspend(); echo "resume coro $id @2\n"; }); echo "start to resume $id @1\n"; co::resume($id); echo "start to resume $id @2\n"; co::resume($id); echo "main\n"; --EXPECT-- start coro 1 start to resume 1 @1 resume coro 1 @1 start to resume 1 @2 resume coro 1 @2 main ~~~