#!/usr/bin/env php advance()) { printf("Stream emitted %d\n", $listener->getCurrent()); yield new Pause(100); // Listener consumption takes 100 ms. } printf("Stream result %d\n", $listener->getResult()); }; yield new Coroutine($generator($producer)); } catch (\Exception $exception) { printf("Exception: %s\n", $exception); } });