#!/usr/bin/env php receive())); print "Sleeping for 3 seconds...\n"; sleep(3); // Blocking call in thread. yield $this->send('Data sent from child.'); print "Sleeping for 2 seconds...\n"; sleep(2); // Blocking call in thread. yield 42; }); print "Waiting 2 seconds to send start data...\n"; yield Coroutine\sleep(2); yield $context->send('Start data'); printf("Received the following from child: %s\n", (yield $context->receive())); printf("Thread ended with value %d!\n", (yield $context->join())); })->cleanup([$timer, 'stop'])->done(); Loop\run();