class Waiter

Constants

DEFAULT_PUSH_TIMEOUT_SECONDS

The default timeout for deferred result delivery and canceled child unwind.

protected DEFAULT_POP_TIMEOUT_SECONDS

Properties

protected float $pushTimeout
protected float $popTimeout

Methods

__construct(float $timeout = self::DEFAULT_POP_TIMEOUT_SECONDS)

No description

mixed
wait(Closure $closure, float|null $timeout = null, bool|array $copyContext = false, bool $waitForChildTermination = false)

Execute a closure in a coroutine and wait for the result.

void
cancelChild(int|null $childCoroutineId, bool $cancellationRequested)

Cancel the owned child once when it is still active.

Details

at line 30
__construct(float $timeout = self::DEFAULT_POP_TIMEOUT_SECONDS)

No description

Parameters

float $timeout

at line 51
mixed wait(Closure $closure, float|null $timeout = null, bool|array $copyContext = false, bool $waitForChildTermination = false)

Execute a closure in a coroutine and wait for the result.

Parameters

Closure $closure
float|null $timeout

Timeout in seconds (null uses default)

bool|array $copyContext

When set, parent coroutine context is copied to the child. false = fresh context (default), true or empty array = copy all keys, non-empty array = copy listed keys only. Objects stored directly in context are shared by reference by default. Values implementing Hypervel\Context\ReplicableContext are copied via replicate(), while values implementing Hypervel\Context\NonCopyableContext are omitted.

bool $waitForChildTermination

Wait without a limit when a canceled child exceeds the cleanup allowance

Return Value

mixed

Exceptions

WaitTimeoutException
ChildTerminationTimeoutException

at line 168
protected void cancelChild(int|null $childCoroutineId, bool $cancellationRequested)

Cancel the owned child once when it is still active.

Parameters

int|null $childCoroutineId
bool $cancellationRequested

Return Value

void