HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)
void omp_destroy_nest_lock(omp_nest_lock_t *lock);
These functions ensure that the pointed to lock variable lock is uninitialized. The argument
to these functions must point to an initialized lock variable that is locked.
omp_set_lock and omp_set_nest_lock
#include <omp.h>
void omp_set_lock(omp_lock_t *lock);
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
216 Exception Handling