OpenMP-Examples/Examples_nesting_restrict.tex

53 lines
1.4 KiB
TeX

\pagebreak
\section{Restrictions on Nesting of Regions}
\label{sec:nesting_restrict}
The examples in this section illustrate the region nesting rules.
The following example is non-conforming because the inner and outer loop regions
are closely nested:
\cexample{nesting_restrict}{1}
\fexample{nesting_restrict}{1}
The following orphaned version of the preceding example is also non-conforming:
\cexample{nesting_restrict}{2}
\fexample{nesting_restrict}{2}
The following example is non-conforming because the loop and \code{single} regions
are closely nested:
\cexample{nesting_restrict}{3}
\fexample{nesting_restrict}{3}
The following example is non-conforming because a \code{barrier} region cannot
be closely nested inside a loop region:
\cexample{nesting_restrict}{4}
\fexample{nesting_restrict}{4}
The following example is non-conforming because the \code{barrier} region cannot
be closely nested inside the \code{critical} region. If this were permitted,
it would result in deadlock due to the fact that only one thread at a time can
enter the \code{critical} region:
\cexample{nesting_restrict}{5}
\fexample{nesting_restrict}{5}
The following example is non-conforming because the \code{barrier} region cannot
be closely nested inside the \code{single} region. If this were permitted, it
would result in deadlock due to the fact that only one thread executes the \code{single}
region:
\cexample{nesting_restrict}{6}
\fexample{nesting_restrict}{6}