Skip to content

Commit

Permalink
hint at parallel timers
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 16, 2012
1 parent f5cc3c2 commit b708fa8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -553,22 +553,22 @@ Get L<Mojo::IOLoop::Steps> object to control the flow of events.
# Control the flow of multiple events
Mojo::IOLoop->steps(
# First step
# First step (simple timer)
sub {
my $steps = shift;
Mojo::IOLoop->timer(2 => $steps->next);
say 'Second step in 2 seconds.';
},
# Second step
# Second step (parallel timers)
sub {
my $steps = shift;
Mojo::IOLoop->timer(1 => $steps->next);
Mojo::IOLoop->timer(3 => $steps->next);
say 'Third step in 3 seconds.';
},
# Third step
# Third step (the end)
sub { say 'And done after 5 seconds total.' }
);
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/IOLoop/Steps.pm
Expand Up @@ -39,22 +39,22 @@ Mojo::IOLoop::Steps - Control flow of events
# Control the flow of multiple events
Mojo::IOLoop::Steps->new(
# First step
# First step (simple timer)
sub {
my $steps = shift;
Mojo::IOLoop->timer(2 => $steps->next);
say 'Second step in 2 seconds.';
},
# Second step
# Second step (parallel timers)
sub {
my ($steps, @args) = @_;
Mojo::IOLoop->timer(1 => $steps->next);
Mojo::IOLoop->timer(3 => $steps->next);
say 'Third step in 3 seconds.';
},
# Third step
# Third step (the end)
sub {
my ($steps, @args) = @_;
say 'And done after 5 seconds total.';
Expand Down

0 comments on commit b708fa8

Please sign in to comment.