mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-04 05:41:33 +01:00
21 lines
824 B
TeX
21 lines
824 B
TeX
%\pagebreak
|
|
\section{\kcode{single} Construct}
|
|
\label{sec:single}
|
|
\index{constructs!single@\kcode{single}}
|
|
\index{single construct@\kcode{single} construct}
|
|
|
|
The following example demonstrates the \kcode{single} construct. In the example,
|
|
only one thread prints each of the progress messages. All other threads will skip
|
|
the \kcode{single} region and stop at the barrier at the end of the \kcode{single}
|
|
construct until all threads in the team have reached the barrier. If other threads
|
|
can proceed without waiting for the thread executing the \kcode{single} region,
|
|
a \kcode{nowait} clause can be specified, as is done in the third \kcode{single}
|
|
construct in this example. The user must not make any assumptions as to which thread
|
|
will execute a \kcode{single} region.
|
|
|
|
\cexample{single}{1}
|
|
|
|
\fexample{single}{1}
|
|
|
|
|