Logo Search packages:      
Sourcecode: chromium-browser version File versions  Download package

int pthread_mutex_unlock ( pthread_mutex_t mutex  ) 

Unlocks a mutex.

Parameters:
mutex The address of the mutex structure to be unlocked.
Returns:
0 upon success, non-zero error code otherwise.

Definition at line 118 of file nc_mutex.c.

References pthread_mutex_t::mutex_handle, pthread_mutex_t::mutex_type, NACL_PTHREAD_ILLEGAL_THREAD_ID, pthread_mutex_t::owner_thread_id, PTHREAD_MUTEX_ERRORCHECK_NP, PTHREAD_MUTEX_FAST_NP, PTHREAD_MUTEX_RECURSIVE_NP, pthread_self(), and pthread_mutex_t::recursion_counter.

Referenced by nacl_multimedia_get_embed_size(), nacl_multimedia_init(), nacl_multimedia_is_embedded(), nacl_multimedia_shutdown(), nacl_video_init(), nacl_video_poll_event(), nacl_video_shutdown(), nacl_video_update(), pthread_detach(), pthread_exit(), pthread_join(), pthread_once(), and SkEvent::SignalQueueTimer().

                                                  {
  pthread_mutex_validate(mutex);
  if (mutex->mutex_type != PTHREAD_MUTEX_FAST_NP) {
    if ((PTHREAD_MUTEX_RECURSIVE_NP == mutex->mutex_type) &&
        (0 != (--mutex->recursion_counter))) {
      /*
       * We assume that this thread owns the lock
       * (no verification for recursive locks),
       * so just decrement the counter, this thread is still the owner
       */
      return 0;
    }
    if ((PTHREAD_MUTEX_ERRORCHECK_NP == mutex->mutex_type) &&
        (pthread_self() != mutex->owner_thread_id)) {
      /* error - releasing a mutex that's free or owned by another thread */
      return EPERM;
    }
  }
  mutex->owner_thread_id = NACL_PTHREAD_ILLEGAL_THREAD_ID;
  mutex->recursion_counter = 0;
  return NACL_SYSCALL(mutex_unlock)(mutex->mutex_handle);
}


Generated by  Doxygen 1.6.0   Back to index