コード例 #1
0
ファイル: pspinunlock.c プロジェクト: 0871087123/rtems
int pthread_spin_unlock(
  pthread_spinlock_t *spinlock
)
{
  POSIX_Spinlock_Control  *the_spinlock = NULL;
  Objects_Locations        location;
  CORE_spinlock_Status     status;

  if ( !spinlock )
    return EINVAL;

  the_spinlock = _POSIX_Spinlock_Get( spinlock, &location );
  switch ( location ) {

    case OBJECTS_LOCAL:
      status = _CORE_spinlock_Release( &the_spinlock->Spinlock );
      _Thread_Enable_dispatch();
      return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );

#if defined(RTEMS_MULTIPROCESSING)
    case OBJECTS_REMOTE:
#endif
    case OBJECTS_ERROR:
      break;
  }

  return EINVAL;
}
コード例 #2
0
ファイル: pspinunlock.c プロジェクト: Dipupo/rtems
int pthread_spin_unlock( pthread_spinlock_t *spinlock )
{
  POSIX_Spinlock_Control *the_spinlock;
  ISR_lock_Context        lock_context;
  CORE_spinlock_Status    status;

  the_spinlock = _POSIX_Spinlock_Get( spinlock, &lock_context );
  if ( the_spinlock == NULL ) {
    return EINVAL;
  }

  status = _CORE_spinlock_Surrender( &the_spinlock->Spinlock, &lock_context );
  return _POSIX_Spinlock_Translate_core_spinlock_return_code( status );
}