omp_init_nest_lock(nvar)

Purpose

The omp_init_nest_lock subroutine allows you to initialize a nestable lock and associate it with the lock variable you specify. The initial state of the lock variable is unlocked, and the initial nesting count is zero. The value of nvar must be an unitialized nestable lock variable.

If you call omp_init_nest_lock using a variable that is already initialized, the result is undefined.

Class

Subroutine.

Argument Type and Attributes

nvar
Integer of kind omp_nest_lock_kind.

Result Type and Attributes

Result Value

Examples

USE omp_lib
INTEGER P
INTEGER A
INTEGER B
INTEGER ( kind=omp_nest_lock_kind ) LCK
 
CALL omp_init_nest_lock ( LCK )
 
!$OMP PARALLEL SECTIONS
!$OMP SECTION
CALL omp_set_nest_lock ( LCK )
P = P + A
CALL omp_set_nest_lock ( LCK )
P = P + B
CALL omp_unset_nest_lock ( LCK )
CALL omp_unset_nest_lock ( LCK )
!$OMP SECTION
CALL omp_set_nest_lock ( LCK )
P = P + B
CALL omp_unset_nest_lock ( LCK )
!$OMP END PARALLEL SECTIONS
 
CALL omp_destroy_nest_lock ( LCK )
END
 
IBM Copyright 2003