2024-04-16 08:59:23 -07:00

33 lines
1.0 KiB
TeX

\pagebreak
\section{\kcode{ordered} Clause and \kcode{ordered} Construct}
\label{sec:ordered}
\index{clauses!ordered@\kcode{ordered}}
\index{ordered clause@\kcode{ordered} clause}
\index{constructs!ordered@\kcode{ordered}}
\index{ordered construct@\kcode{ordered} construct}
The \kcode{ordered} constructs are useful for sequentially ordering the output from work that
is done in parallel. The following program prints out the indices in sequential
order:
\cexample{ordered}{1}
\fexample{ordered}{1}
It is possible to have multiple \kcode{ordered} constructs within a loop region
with the \kcode{ordered} clause specified. The first example is non-conforming
because all iterations execute two \kcode{ordered} regions. An iteration of a
loop must not execute more than one \kcode{ordered} region:
\cexample{ordered}{2}
\fexample{ordered}{2}
The following is a conforming example with more than one \kcode{ordered} construct.
Each iteration will execute only one \kcode{ordered} region:
\cexample{ordered}{3}
\fexample{ordered}{3}