Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adds race/hyper closes #534 refs #2034
  • Loading branch information
JJ committed Apr 16, 2019
1 parent 809ee43 commit de50714
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doc/Language/statement-prefixes.pod6
Expand Up @@ -53,6 +53,22 @@ However, with C<eager> as a statement prefix it will run all three iterations in
the loop, as shown by the printed "Hey", even if we are just requesting the
first one in a row.
=head2 X<C<hyper>|hyper (statement prefix)>, X<C<race>|race (statement prefix)>
C<hyper> and C<race> use (maybe simultaneous) threads to run different
iterations in a loop:
=for code
my $main-thread = $*THREAD.id;
my $saw-another-thread = False;
race for ^10000 {
$saw-another-thread = True if $*THREAD.id != $main-thread;
}
ok $saw-another-thread, 'A race for loop runs the body over threads';
Unless you can come up with a real use case it's probably better that you try
and reduce your problem to a single data structure and use them in L<method
form|/routine/hyper>.
=end pod

Expand Down

0 comments on commit de50714

Please sign in to comment.