• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/bomp/

Lines Matching defs:lock

509  * General-purpose lock routines. Two types of locks are supported: simple locks
510 * and nestable locks. A nestable lock can be set multiple times by the same task
511 * before being unset; a simple lock cannot be set if it is already owned by the
523 /// internal declaration of a simple lock
545 * \brief initializes and allocates a simple OpenMP lock
547 * \param arg returned pointer to the lock
549 * The effect of these routines is to initialize the lock to the unlocked state;
550 * that is, no task owns the lock.
552 void omp_init_lock(omp_lock_t *lock)
557 thread_mutex_init(&lock->mutex);
567 pthread_mutex_init(&lock->mutex, NULL);
569 lock->initialized = 0x1;
573 * \brief destroys a simple OpenMP lock
575 * \param arg OpenMP lock to destroyed (set to zero)
577 * The effect of these routines is to change the state of the lock to uninitialized.
581 struct __omp_lock *lock = (struct __omp_lock *) arg;
582 lock->initialized = 0x0;
595 pthread_mutex_destroy(&lock->mutex);
600 * \brief acquires a simple OpenMP lock
602 * \param arg The lock to acquire
605 * until the specified lock is available and then sets the lock.
609 struct __omp_lock *lock = (struct __omp_lock *) arg;
610 assert(lock->initialized);
612 thread_mutex_lock(&lock->mutex);
614 pthread_mutex_lock(&lock->mutex);
619 * \brief Releases the simple OpenMP lock
621 * \param arg The lock to be released
623 * For a simple lock, the omp_unset_lock routine causes the lock to become
628 struct __omp_lock *lock = (struct __omp_lock *) arg;
629 assert(lock->initialized);
631 thread_mutex_unlock(&lock->mutex);
633 pthread_mutex_unlock(&lock->mutex);
638 * \brief tries to acquire a simple openMP lock
640 * \param arg The OpenMP lock to acquire
642 * \returns TRUE if lock is acquired successfully
643 * FALSE if lock is already held by other thread
645 * These routines attempt to set a lock in the same manner as omp_set_lock and
648 * For a simple lock, the omp_test_lock routine returns true if the lock is
653 struct __omp_lock *lock = (struct __omp_lock *) arg;
654 assert(lock->initialized);
656 return thread_mutex_trylock(&lock->mutex);
658 return pthread_mutex_trylock (&lock->mutex) == 0;
667 * \brief initializes and allocates a nested OpenMP lock
669 * \param arg returned pointer to the lock
671 * The effect of these routines is to initialize the lock to the unlocked state;
672 * that is, no task owns the lock. In addition, the nesting count for a nestable
673 * lock is set to zero.
692 if (lock == NULL) {
693 printf("failed to allocate lock\n");
704 * \brief destroys a Nested OpenMP lock
706 * \param arg OpenMP lock to destroyed (set to zero)
708 * The effect of these routines is to change the state of the lock to uninitialized.
726 pthread_mutex_destroy(&lock->mutex);
732 * \brief acquires a simple OpenMP lock
734 * \param arg The lock to acquire
737 * until the specified lock is available and then sets the lock.
739 * A nestable lock is available if it is unlocked or if it is already owned by
741 * or retains, ownership of the lock, and the nesting count for the lock is
764 * \brief Releases the simple OpenMP lock
766 * \param arg The lock to be released
768 * For a nestable lock, the omp_unset_nest_lock routine decrements the nesting
769 * count, and causes the lock to become unlocked if the resulting nesting count
790 * \brief tries to acquire a simple openMP lock
792 * \param arg The OpenMP lock to acquire
794 * \returns TRUE if lock is acquired successfully
795 * FALSE if lock is already held by other thread
797 * These routines attempt to set a lock in the same manner as omp_set_lock and
800 * For a nestable lock, the omp_test_nest_lock routine returns the new nesting
801 * count if the lock is successfully set; otherwise, it returns zero.
817 if (pthread_mutex_trylock (&lock->lock) != 0)