2024-04-16 08:59:23 -07:00

26 lines
1022 B
TeX

\pagebreak
\section{\kcode{masked} Construct}
\label{sec:masked}
\index{constructs!masked@\kcode{masked}}
\index{masked construct@\kcode{masked} construct}
\index{masked construct@\kcode{masked} construct!filter clause@\kcode{filter} clause}
\index{clauses!filter@\kcode{filter}}
\index{filter clause@\kcode{filter} clause}
The following example demonstrates the \kcode{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 \kcode{masked} region without waiting.
The \kcode{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 \kcode{masked} construct after the iteration loop.
If the thread specified in a \kcode{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}