mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-04 05:41:33 +01:00
25 lines
998 B
TeX
25 lines
998 B
TeX
\pagebreak
|
|
\chapter{Binding of \code{barrier} Regions}
|
|
\label{chap:barrier_regions}
|
|
|
|
The binding rules call for a \code{barrier} region to bind to the closest enclosing
|
|
\code{parallel} region.
|
|
|
|
In the following example, the call from the main program to \plc{sub2} is conforming
|
|
because the \code{barrier} region (in \plc{sub3}) binds to the \code{parallel}
|
|
region in \plc{sub2}. The call from the main program to \plc{sub1} is conforming
|
|
because the \code{barrier} region binds to the \code{parallel} region in subroutine
|
|
\plc{sub2}.
|
|
|
|
The call from the main program to \plc{sub3} is conforming because the \code{barrier}
|
|
region binds to the implicit inactive \code{parallel} region enclosing the sequential
|
|
part. Also note that the \code{barrier} region in \plc{sub3} when called from
|
|
\plc{sub2} only synchronizes the team of threads in the enclosing \code{parallel}
|
|
region and not all the threads created in \plc{sub1}.
|
|
|
|
\cexample{barrier_regions}{1c}
|
|
|
|
\fexample{barrier_regions}{1f}
|
|
|
|
|