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

26 lines
1011 B
TeX

\pagebreak
\section{\code{masked} Construct}
\label{sec:masked}
\index{constructs!masked@\code{masked}}
\index{masked construct@\code{masked} construct}
\index{masked construct@\code{masked} construct!filter clause@\code{filter} clause}
\index{clauses!filter@\code{filter}}
\index{filter clause@\code{filter} clause}
The following example demonstrates the \code{masked} construct.
In the example, the primary thread (thread number 0)
keeps track of how many iterations have been executed and prints out
a progress report in the iteration loop.
The other threads skip the \code{masked} region without waiting.
The \code{filter} clause can be used to specify a thread number other
than the primary thread to execute a structured block, as illustrated by
the second \code{masked} construct after the iteration loop.
If the thread specified in a \scode{filter} clause does not exist
in the team then the structured block is not executed by any thread.
\cexample[5.1]{masked}{1}
\fexample[5.1]{masked}{1}