Esempio n. 1
0
  static bool _Thread_Handler_is_constructor_execution_required(
    Thread_Control *executing
  )
  {
    static bool doneConstructors;
    bool doCons = false;

    #if defined(RTEMS_SMP)
      static SMP_lock_Control constructor_lock = SMP_LOCK_INITIALIZER;

      if ( !doneConstructors ) {
        _SMP_lock_Acquire( &constructor_lock );
    #endif

    #if defined(RTEMS_MULTIPROCESSING)
      doCons = !doneConstructors
        && _Objects_Get_API( executing->Object.id ) != OBJECTS_INTERNAL_API;
      if (doCons)
        doneConstructors = true;
    #else
      (void) executing;
      doCons = !doneConstructors;
      doneConstructors = true;
    #endif

    #if defined(RTEMS_SMP)
        _SMP_lock_Release( &constructor_lock );
      }
    #endif

    return doCons;
  }
static void _Giant_Do_acquire( uint32_t self_cpu_index )
{
  Giant_Control *giant = &_Giant;

  if ( giant->owner_cpu != self_cpu_index ) {
    _SMP_lock_Acquire( &giant->lock );
    giant->owner_cpu = self_cpu_index;
    giant->nest_level = 1;
  } else {
    ++giant->nest_level;
  }
}
static void _Giant_Do_acquire( Per_CPU_Control *self_cpu )
{
  Giant_Control *giant = &_Giant;
  uint32_t self_cpu_index = _Per_CPU_Get_index( self_cpu );

  if ( giant->owner_cpu != self_cpu_index ) {
    _SMP_lock_Acquire( &giant->lock, &self_cpu->Giant_lock_context );
    giant->owner_cpu = self_cpu_index;
    giant->nest_level = 1;
  } else {
    ++giant->nest_level;
  }
}