*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> f90/omp_lock (3)              
Title
Content
Arch
Section
 

Contents


OMP_LOCK(3)					      Last changed: 2-24-98

NAME    [Toc]    [Back]

     omp_init_lock, omp_destroy_lock, omp_set_lock, omp_unset_lock,
     omp_test_lock, OMP_INIT_LOCK, OMP_DESTROY_LOCK, OMP_SET_LOCK,
     OMP_UNSET_LOCK, OMP_TEST_LOCK,  - Set of procedures to manipulate
     locks

SYNOPSIS    [Toc]    [Back]

     C/C++: (Deferred implementation)
	  #integer <omp_init_lock>
	  void omp_init_lock(var)

	  #integer <omp_destroy_lock>
	  void omp_destory_lock(var)

	  #integer <omp_set_lock>
	  void omp_set_lock(var)

	  #integer <omp_unset_lock>
	  void omp_unset_lock(var)

	  #integer <omp_test_lock>
	  int omp_test_lock(var)

     Fortran:
	  CALL OMP_INIT_LOCK(var)

	  CALL OMP_DESTROY_LOCK(var)

	  CALL OMP_SET_LOCK(var)

	  CALL OMP_UNSET_LOCK(var)

	  LOGICAL OMP_TEST_LOCK(var)

IMPLEMENTATION    [Toc]    [Back]

     IRIX systems

STANDARDS    [Toc]    [Back]

     OpenMP Fortran API

DESCRIPTION    [Toc]    [Back]

     The following descriptions	contain	information for	Fortran	and C/C++.

     omp_init_lock, OMP_INIT_LOCK
	  This subroutine initializes a	lock associated	with the lock
	  variable var for use in subsequent calls.

	  The initial state is unlocked.  The lock variable must only be
	  accessed through these routines.  In this and	the following lock
	  routines, var	should be a scalar integer variable in C and of
	  type integer in Fortran and must have	a size large enough to hold
	  an address.  For example, for	64-bit addressable systems, the
	  variable must	at least by declared as	INTEGER*8.

     omp_destory_lock, OMP_DESTROY_LOCK
	  This procedure disassociates the given lock variable var from	any
	  locks.

     omp_set_lock, OMP_SET_LOCK
	  This procedure constrins the executing thread	to wait	until the
	  specified lock is available.	The thread is granted ownership	of
	  the lock when	it is available.

     omp_unset_lock, OMP_UNSET_LOCK
	  This procedure releases the executing	thread from ownership of
	  the lock.  The behavior is undefined if the thread does not own
	  that lock.

     omp_test_lock, OMP_TEST_LOCK
	  This function	tries to set the lock associated with the lock
	  variable var.	 It returns non-zero (TRUE) if the lock	is
	  successfully set; otherwise, it returns zero (FALSE).

EXAMPLES    [Toc]    [Back]

     In	the following Fortran 90 example, the argument to the lock routines
     should be of size POINTER:

		PROGRAM	LOCK_USAGE
		EXTERNAL OMP_TEST_LOCK
		LOGICAL	OMP_TEST_LOCK

		INTEGER	LCK	    ! THIS VARIABLE SHOULD BE POINTER SIZED

		CALL OMP_INIT_LOCK(LCK)
	  !$OMP	PARALLEL SHARED(LCK) PRIVATE(ID)
		ID = OMP_GET_THREAD_NUM()
		CALL OMP_SET_LOCK(LCK)
		PRINT *, 'MY THREAD ID IS ', ID
		CALL OMP_UNSET_LOCK(LCK)

		DO WHILE (.NOT.	OMP_TEST_LOCK(LCK))
		  CALL SKIP(ID)	    ! WE DO NOT	YET HAVE THE LOCK
				    ! SO WE MUST DO SOMETHING ELSE
		END DO

		CALL WORK(ID)	    ! WE NOW HAVE THE LOCK
				    ! AND CAN DO THE WORK
		CALL OMP_UNSET_LOCK( LCK )
	  !$OMP	END PARALLEL

		CALL OMP_DESTROY_LOCK( LCK )

		END

SEE ALSO    [Toc]    [Back]

      
      
     omp_nested(3) to manipulate or report status of nested parallelism,

     omp_threads(3) for	runtime	library	procedures used	to set,	call or
     return numbers of threads

     This man page is available	only online.
[ Back ]
 Similar pages
Name OS Title
BUF_TIMELOCK FreeBSD locks a buffer
BUF_LOCK FreeBSD locks a buffer
pthread_mutex_lock IRIX mutual exclusion locks
tis_mutex_lock Tru64 Locks an unlocked mutex
pthread_mutex_lock Tru64 Locks an unlocked mutex
BUF_LOCK Tru64 General: Locks the specified I/O buffer
dxpause Tru64 locks (pauses) an X display
nflocks HP-UX maximum number of file locks
ttyunlock NetBSD locks based on files containing PIDs
pthread_lock_global_np Tru64 Locks the DECthreads global mutex
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service