int pthread_barrier_wait(
  pthread_barrier_t *barrier
)
{
  POSIX_Barrier_Control   *the_barrier = NULL;
  Objects_Locations        location;

  if ( !barrier )
    return EINVAL;

  the_barrier = _POSIX_Barrier_Get( barrier, &location );
  switch ( location ) {

    case OBJECTS_LOCAL:
      _CORE_barrier_Wait(
        &the_barrier->Barrier,
        the_barrier->Object.id,
        true,
        0,
        NULL
      );
      _Thread_Enable_dispatch();
      return _POSIX_Barrier_Translate_core_barrier_return_code(
                _Thread_Executing->Wait.return_code );

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

  return EINVAL;
}
Ejemplo n.º 2
0
rtems_status_code rtems_barrier_wait(
  rtems_id        id,
  rtems_interval  timeout
)
{
  Barrier_Control   *the_barrier;
  Objects_Locations  location;

  the_barrier = _Barrier_Get( id, &location );
  switch ( location ) {
    case OBJECTS_REMOTE:
    case OBJECTS_ERROR:
      return RTEMS_INVALID_ID;

    case OBJECTS_LOCAL:
      _CORE_barrier_Wait(
        &the_barrier->Barrier,
        id,
        TRUE,
        timeout,
        NULL
      );
      _Thread_Enable_dispatch();
      return _Barrier_Translate_core_barrier_return_code(
                _Thread_Executing->Wait.return_code );

  }

  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
}
Ejemplo n.º 3
0
rtems_status_code rtems_barrier_wait(
    rtems_id        id,
    rtems_interval  timeout
)
{
    Barrier_Control   *the_barrier;
    Objects_Locations  location;

    the_barrier = _Barrier_Get( id, &location );
    switch ( location ) {

    case OBJECTS_LOCAL:
        _CORE_barrier_Wait(
            &the_barrier->Barrier,
            id,
            true,
            timeout,
            NULL
        );
        _Thread_Enable_dispatch();
        return _Barrier_Translate_core_barrier_return_code(
                   _Thread_Executing->Wait.return_code );

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

    return RTEMS_INVALID_ID;
}