PHP Class Amp\Coroutine

When a promise is yielded, execution of the generator is interrupted until the promise is resolved. A success value is sent into the generator, while a failure reason is thrown into the generator. Using a coroutine, asynchronous code can be written without callbacks and be structured like synchronous code.
Inheritance: implements amp\Promise, use trait Amp\Internal\Placeholder
Mostrar archivo Open project: amphp/amp Class Usage Examples

Public Methods

Method Description
__construct ( Generator $generator )

Private Methods

Method Description
dispose ( Throwable $exception ) Runs the generator to completion then fails the coroutine with the given exception.

Method Details

__construct() public method

public __construct ( Generator $generator )
$generator Generator