mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-10 16:32:11 +01:00
19 lines
629 B
TeX
19 lines
629 B
TeX
\subsection{Simple Lock Routines}
|
|
\label{subsec:simple_lock}
|
|
|
|
In the following example, the lock routines cause the threads to be idle while
|
|
waiting for entry to the first critical section, but to do other work while waiting
|
|
for entry to the second. The \code{omp\_set\_lock} function blocks, but the \code{omp\_test\_lock}
|
|
function does not, allowing the work in \code{skip} to be done.
|
|
|
|
Note that the argument to the lock routines should have type \code{omp\_lock\_t},
|
|
and that there is no need to flush it.
|
|
|
|
\cexample{simple_lock}{1}
|
|
|
|
Note that there is no need to flush the lock variable.
|
|
|
|
\fexample{simple_lock}{1}
|
|
|
|
|