Skip to content

Commit

Permalink
use the term concurrent instead of parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 5, 2014
1 parent db81e0b commit 7d579de
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/IOLoop.pm
Expand Up @@ -463,7 +463,7 @@ a chain for L<Mojo::IOLoop::Delay/"steps">.
say 'Second step in 2 seconds.';
},
# Second step (parallel timers)
# Second step (concurrent timers)
sub {
my $delay = shift;
Mojo::IOLoop->timer(1 => $delay->begin);
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/IOLoop/Delay.pm
Expand Up @@ -84,7 +84,7 @@ Mojo::IOLoop::Delay - Manage callbacks and control the flow of events
say 'Second step in 2 seconds.';
},
# Second step (parallel timers)
# Second step (concurrent timers)
sub {
my ($delay, @args) = @_;
Mojo::IOLoop->timer(1 => $delay->begin);
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -422,7 +422,7 @@ Mojo::UserAgent - Non-blocking I/O HTTP and WebSocket user agent
my $tx = $ua->cert('tls.crt')->key('tls.key')
->post('https://example.com' => json => {top => 'secret'});
# Blocking parallel requests (does not work inside a running event loop)
# Blocking concurrent requests (does not work inside a running event loop)
my $delay = Mojo::IOLoop->delay;
for my $url ('mojolicio.us', 'cpan.org') {
my $end = $delay->begin(0);
Expand All @@ -433,7 +433,7 @@ Mojo::UserAgent - Non-blocking I/O HTTP and WebSocket user agent
}
my @titles = $delay->wait;
# Non-blocking parallel requests (does work inside a running event loop)
# Non-blocking concurrent requests (does work inside a running event loop)
my $delay = Mojo::IOLoop->delay(sub {
my ($delay, @titles) = @_;
...
Expand Down
10 changes: 5 additions & 5 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -377,7 +377,7 @@ latency backend web services.
</body>
</html>

Multiple events such as parallel requests can be easily synchronized with
Multiple events such as concurrent requests can be easily synchronized with
L<Mojo::IOLoop/"delay">, which can help you avoid deep nested closures that
often result from continuation-passing style.

Expand All @@ -392,7 +392,7 @@ often result from continuation-passing style.
# Prepare response in two steps
Mojo::IOLoop->delay(

# Parallel requests
# Concurrent requests
sub {
my $delay = shift;
my $url = Mojo::URL->new('api.metacpan.org/v0/module/_search');
Expand All @@ -419,7 +419,7 @@ often result from continuation-passing style.
Another primary feature of the event loop are timers, which are created with
L<Mojo::IOLoop/"timer"> and can for example be used to delay rendering of a
response, and unlike C<sleep>, won't block any other requests that might be
processed in parallel.
processed concurrently.

use Mojolicious::Lite;
use Mojo::IOLoop;
Expand Down Expand Up @@ -998,7 +998,7 @@ can keep many concurrent connections active at the same time.
use Mojo::UserAgent;
use Mojo::IOLoop;

# Parallel non-blocking requests
# Concurrent non-blocking requests
my $ua = Mojo::UserAgent->new;
$ua->get('http://metacpan.org/search?q=mojo' => sub {
my ($ua, $mojo) = @_;
Expand All @@ -1014,7 +1014,7 @@ can keep many concurrent connections active at the same time.

You can take full control of the L<Mojo::IOLoop> event loop.

=head2 Parallel blocking requests
=head2 Concurrent blocking requests

You can emulate blocking behavior by using L<Mojo::IOLoop/"delay"> to
synchronize multiple non-blocking requests.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Lite.pm
Expand Up @@ -867,7 +867,7 @@ L<Mojo::JSON> and L<Mojo::DOM> this can be a very powerful tool.
});
};
# Parallel non-blocking
# Concurrent non-blocking
get '/titles' => sub {
my $self = shift;
my $delay = Mojo::IOLoop->delay(sub {
Expand Down
10 changes: 5 additions & 5 deletions t/mojo/daemon.t
Expand Up @@ -142,12 +142,12 @@ ok defined $tx->connection, 'has connection id';
is $tx->res->code, 200, 'right status';
is $tx->res->body, 'Whatever!', 'right content';

# Parallel requests
# Concurrent requests
my $delay = Mojo::IOLoop->delay;
$ua->get('/parallel1/' => $delay->begin);
$ua->post(
'/parallel2/' => {Expect => 'fun'} => 'bar baz foo' x 128 => $delay->begin);
$ua->get('/parallel3/' => $delay->begin);
$ua->get('/concurrent1/' => $delay->begin);
$ua->post('/concurrent2/' => {Expect => 'fun'} => 'bar baz foo' x 128 =>
$delay->begin);
$ua->get('/concurrent3/' => $delay->begin);
($tx, my $tx2, my $tx3) = $delay->wait;
ok $tx->is_finished, 'transaction is finished';
is $tx->res->body, 'Whatever!', 'right content';
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/reactor_ev.t
Expand Up @@ -153,7 +153,7 @@ ok !$writable, 'io event was not triggered again';
my $reactor2 = Mojo::Reactor::EV->new;
is ref $reactor2, 'Mojo::Reactor::Poll', 'right object';

# Parallel reactors
# Concurrent reactors
$timer = 0;
$reactor->recurring(0 => sub { $timer++ });
my $timer2;
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/reactor_poll.t
Expand Up @@ -151,7 +151,7 @@ ok !$writable, 'io event was not triggered again';
my $reactor2 = Mojo::Reactor::Poll->new;
is ref $reactor2, 'Mojo::Reactor::Poll', 'right object';

# Parallel reactors
# Concurrent reactors
$timer = 0;
$reactor->recurring(0 => sub { $timer++ });
my $timer2;
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/websocket.t
Expand Up @@ -269,7 +269,7 @@ is $stash->{finished}, 1, 'finish event has been emitted once';
is $code, 101, 'right status';
is $result, 'test0test1', 'right result';

# Parallel subrequests
# Concurrent subrequests
my $delay = Mojo::IOLoop->delay;
($code, $result) = ();
my ($code2, $result2);
Expand Down

0 comments on commit 7d579de

Please sign in to comment.