纤程(Fiber)类

(PHP 8 >= 8.1.0)

简介

纤程(Fiber)代表了有完整栈、可中断的功能。Fiber 可以从调用堆栈中的任何位置挂起,在 fiber 内暂停执行,直到稍后恢复 fiber。

类摘要

final class Fiber {
/* 方法 */
public __construct(callable $callback)
public start(mixed ...$args): mixed
public resume(mixed $value = null): mixed
public throw(Throwable $exception): mixed
public getReturn(): mixed
public isStarted(): bool
public isSuspended(): bool
public isRunning(): bool
public isTerminated(): bool
public static suspend(mixed $value = null): mixed
public static getCurrent(): ?Fiber
}

参见

纤程概述

目录