Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
show the calling subroutine too
  • Loading branch information
kraih committed Jan 30, 2015
1 parent 37304c2 commit 774c03e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/Mojolicious/Guides/FAQ.pod
Expand Up @@ -87,19 +87,23 @@ recommend using an environment which does not set these variables.
A I<blocking> operation is a subroutine that blocks the execution of the
calling subroutine until the subroutine is finished.

my $result = blocking_subroutine();
...
sub foo {
my $result = blocking_subroutine();
...
}

A I<non-blocking> operation on the other hand lets the calling subroutine
continue execution even though the subroutine is not yet finished. Instead of
waiting, the calling subroutine passes along a callback to be executed once
the subroutine is finished, this is called continuation-passing style.

non_blocking_subroutine(sub {
my $result = shift;
sub foo {
non_blocking_subroutine(sub {
my $result = shift;
...
});
...
});
...
}

=head2 Will my code magically become non-blocking with Mojolicious?

Expand Down

0 comments on commit 774c03e

Please sign in to comment.