phasync
SelectableInterface / await

Method

SelectableInterface::await

Waits until the object is ready: using it would not block.

Description#

public SelectableInterface::await(
    float $timeout = PHP_FLOAT_MAX
): void

What a timeout does depends on the object: channels and WaitGroup throw a TimeoutException, a StringBuffer returns, and a RateLimiter has none.

Parameters#

$timeout float = PHP_FLOAT_MAX
Seconds to wait at most

See also#

  • SelectableInterface::isReadyReturns true when using the object would not block, for example because data is available or the source is closed or failed.