OpenMP Lock Functions/2
int omp_test_lock(omp_lock_t *lock);
int omp_test_nest_lock(omp_nest_lock_t *lock);
- these functions attempt to get the lock in the same way as omp_set_(nest)_lock, except these functions are non-blocking
- for a simple lock, the function returns non-zero if the lock is successfully set, otherwise it returns 0
- for a nestable lock, the function returns the new nesting count if the lock is successfully set, otherwise it returns 0
/* spin until the lock is granted */
while( !omp_test_lock(lck));