mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-04 05:41:33 +01:00
17 lines
558 B
TeX
17 lines
558 B
TeX
\pagebreak
|
|
\chapter{The \code{critical} Construct}
|
|
\label{chap:critical}
|
|
|
|
The following example includes several \code{critical} constructs . The example
|
|
illustrates a queuing model in which a task is dequeued and worked on. To guard
|
|
against multiple threads dequeuing the same task, the dequeuing operation must
|
|
be in a \code{critical} region. Because the two queues in this example are independent,
|
|
they are protected by \code{critical} constructs with different names, \plc{xaxis}
|
|
and \plc{yaxis}.
|
|
|
|
\cexample{critical}{1c}
|
|
|
|
\fexample{critical}{1f}
|
|
|
|
|