Skip to content

Commit

Permalink
Adapting example to produce consistent output
Browse files Browse the repository at this point in the history
  • Loading branch information
Benoit Viguier committed Jul 23, 2019
1 parent 50245e2 commit b1b4a1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/01-async-countdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ function asynchronousCountdown(EventLoop $eventLoop, string $name, int $count):
//$eventLoop = new Adapter\Amp\EventLoop();
//$eventLoop = new Adapter\ReactPhp\EventLoop(new React\EventLoop\StreamSelectLoop());

echo "Let's start!\n";

// We can't get directly the result of an asynchronous function,
// but the event loop gives us a promise.
$promiseAlice10 = $eventLoop->async(asynchronousCountdown($eventLoop, 'Alice', 10));
$promiseBob4 = $eventLoop->async(asynchronousCountdown($eventLoop, 'Bob', 4));

echo "Let's start!\n";
// Run the event loop until our goal promise is reached.
$result = $eventLoop->wait(
// We group both promises in one, to run them concurrently.
Expand Down

0 comments on commit b1b4a1d

Please sign in to comment.