Example 16-4. Example:
parloop c::=clusters!; do ... end |
parloop_statement ==>
parloop statement_list do statement_list end |
Example 16-5. The parloop statement is syntactic sugar to make convenient a common parallel programming idiom.
parloop S1 do S2 end; |
is syntactic sugar for:
par
loop
S1
fork
S2
end;
end;
end; |
Example 16-6. This code applies 'frobnify' using a separate thread for each element of an array.
par
loop
e::= a.elt!;
fork
e.frobnify;
end;
end
end |
Example 16-7. Using the parloop shorthand, the same code could also be written:
parloop e: := a.elt!; do e.frobnify; end; |