HP aC++/HP C A.06.25 Programmer's Guide
void omp_set_nest_lock(omp_nest_lock_t *lock);
Each of these functions blocks the thread executing the function until the specified lock
is available and then sets the lock. A simple lock is available if it is unlocked. A nestable
lock is available if it is unlocked or if it is already owned by the thread executing the
function. For a simple lock, the argument to the omp_set_lock function must point
to an initialized lock variable. Ownership of the lock is granted to the thread executing
the function.
For a nestable lock, the argument to the omp_set_nest_lock function must point to
an initialized lock variable. The nesting count is incremented, and the thread is granted,
or retains, ownership of the lock.
omp_unset_lock and omp_unset_nest_lock
#include <omp.h>
void omp_unset_lock(omp_lock_t *lock);
void omp_unset_nest_lock(omp_nest_lock_t *lock);
These functions provide the means of releasing ownership of a lock. The argument to
each of these functions must point to an initialized lock variable owned by the thread
executing the function. The behavior is undefined if the thread does not own that lock.
For a simple lock, the omp_unset_lock function releases the thread executing the
function from ownership of the lock.
For a nestable lock, the omp_unset_nest_lock function decrements the nesting
count, and releases the thread executing the function from ownership of the lock if the
resulting count is zero.
omp_test_lock and omp_test_nest_lock Functions
#include <omp.h>
int omp_test_lock(omp_lock_t *lock);
int omp_test_nest_lock(omp_nest_lock_t *lock);
These functions attempt to set a lock but do not block execution of the thread. The
argument must point to an initialized lock variable. These functions attempt to set a
lock in the same manner as omp_set_lock and omp_set_nest_lock, except that
they do not block execution of the thread.For a simple lock, the omp_test_lock
function returns non-zero if the lock is successfully set; otherwise, it returns zero.
For a nestable lock, the omp_test_nest_lock function returns the new nesting count
if the lock is successfully set; otherwise, it returns zero.
Parallel Programming Using OpenMP 227