Next: , Previous: omp_set_lock, Up: Runtime Library Routines


2.22 omp_test_lock – Test and set simple lock if available

Description:
Before setting a simple lock, the lock variable must be initialized by omp_init_lock. Contrary to omp_set_lock, omp_test_lock does not block if the lock is not available. This function returns true upon success, false otherwise. Here, true and false represent their language-specific counterparts.
C/C++:

Prototype: int omp_test_lock(omp_lock_t *lock);

Fortran:

Interface: subroutine omp_test_lock(lock)
logical(omp_logical_kind) :: omp_test_lock
integer(omp_lock_kind), intent(inout) :: lock

See also:
omp_init_lock, omp_set_lock, omp_set_lock
Reference:
OpenMP specifications v3.0, section 3.3.5.