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 toomp_set_lock
,omp_test_lock
does not block if the lock is not available. This function returnstrue
upon success,false
otherwise. Here,true
andfalse
represent their language-specific counterparts.
C/C++:
Prototype:
int omp_test_lock(omp_lock_t *lock);
Fortran:
Interface:
logical function omp_test_lock(svar)
integer(omp_lock_kind), intent(inout) :: svar
See also:
omp_init_lock, omp_set_lock, omp_set_lock
Reference:
OpenMP specification v4.5, Section 3.3.6.