2022-04-18 15:02:25 -07:00

21 lines
813 B
TeX

\pagebreak
\section{\code{single} Construct}
\label{sec:single}
\index{constructs!single@\code{single}}
\index{single construct@\code{single} construct}
The following example demonstrates the \code{single} construct. In the example,
only one thread prints each of the progress messages. All other threads will skip
the \code{single} region and stop at the barrier at the end of the \code{single}
construct until all threads in the team have reached the barrier. If other threads
can proceed without waiting for the thread executing the \code{single} region,
a \code{nowait} clause can be specified, as is done in the third \code{single}
construct in this example. The user must not make any assumptions as to which thread
will execute a \code{single} region.
\cexample{single}{1}
\fexample{single}{1}