OpenMP-Examples/tasking/taskyield.tex
2022-04-18 15:02:25 -07:00

17 lines
632 B
TeX

\pagebreak
\section{\code{taskyield} Construct}
\label{sec:taskyield}
\index{constructs!taskyield@\code{taskyield}}
\index{taskyield construct@\code{taskyield} construct}
The following example illustrates the use of the \code{taskyield} directive.
The tasks in the example compute something useful and then do some computation
that must be done in a critical region. By using \code{taskyield} when a task
cannot get access to the \code{critical} region the implementation can suspend
the current task and schedule some other task that can do something useful.
\cexample[3.1]{taskyield}{1}
\ffreeexample[3.1]{taskyield}{1}