Changeset 54c3fbd in rtems


Ignore:
Timestamp:
Dec 11, 2015, 10:09:13 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
173d1f8
Parents:
af418e8f
git-author:
Sebastian Huber <sebastian.huber@…> (12/11/15 10:09:13)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/15/15 06:41:34)
Message:

score: Initialize thread control to zero

This reduces the code size of the thread initialization.

Location:
cpukit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/pthread.c

    raf418e8f r54c3fbd  
    207207   *  POSIX 1003.1 1996, 18.2.2.2
    208208   */
    209   api->cancelation_requested = 0;
    210   api->cancelability_state = PTHREAD_CANCEL_ENABLE;
    211   api->cancelability_type = PTHREAD_CANCEL_DEFERRED;
    212   api->last_cleanup_context = NULL;
     209  RTEMS_STATIC_ASSERT( PTHREAD_CANCEL_ENABLE == 0, cancelability_state );
     210  RTEMS_STATIC_ASSERT( PTHREAD_CANCEL_DEFERRED == 0, cancelability_type );
    213211
    214212  /*
     
    218216   *  The check for class == 1 is debug.  Should never really happen.
    219217   */
    220   api->signals_pending = SIGNAL_EMPTY_MASK;
     218  RTEMS_STATIC_ASSERT( SIGNAL_EMPTY_MASK == 0, signals_pending );
    221219  if ( _Objects_Get_API( created->Object.id ) == OBJECTS_POSIX_API
    222220       #if defined(RTEMS_DEBUG)
     
    230228  }
    231229
    232   _Thread_Action_initialize( &api->Signal_action );
    233230  _Thread_queue_Initialize( &api->Join_List, THREAD_QUEUE_DISCIPLINE_FIFO );
    234231
    235   _Watchdog_Preinitialize( &api->Sporadic_timer );
    236232  _Watchdog_Initialize(
    237233    &api->Sporadic_timer,
  • cpukit/rtems/include/rtems/rtems/asrimpl.h

    raf418e8f r54c3fbd  
    5252{
    5353  _ISR_lock_Initialize( &asr->Lock, "ASR" );
    54   _ASR_Initialize( asr );
     54  RTEMS_STATIC_ASSERT( RTEMS_DEFAULT_MODES == 0, _ASR_Create_mode_set );
    5555}
    5656
  • cpukit/rtems/src/tasks.c

    raf418e8f r54c3fbd  
    5656
    5757  _ASR_Create( &api->Signal );
    58   _Thread_Action_initialize( &api->Signal_action );
    59 #if !defined(RTEMS_SMP)
    60   created->task_variables = NULL;
    61 #endif
    62 
    63   /*
    64    * We know this is deprecated and don't want a warning on every BSP built.
    65    */
    66   #pragma GCC diagnostic push
    67   #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
    68   if ( rtems_configuration_get_notepads_enabled() ) {
    69     for (i=0; i < RTEMS_NUMBER_NOTEPADS; i++)
    70       api->Notepads[i] = 0;
    71   }
    72   #pragma GCC diagnostic pop
    7358
    7459  return true;
  • cpukit/score/src/threadinitialize.c

    raf418e8f r54c3fbd  
    6262#endif
    6363
     64  memset(
     65    &the_thread->current_state,
     66    0,
     67    information->Objects.size - offsetof( Thread_Control, current_state )
     68  );
     69
    6470  for ( i = 0 ; i < _Thread_Control_add_on_count ; ++i ) {
    6571    const Thread_Control_add_on *add_on = &_Thread_Control_add_ons[ i ];
     
    6874      (char *) the_thread + add_on->source_offset;
    6975  }
    70 
    71   /*
    72    *  Initialize the Ada self pointer
    73    */
    74   #if __RTEMS_ADA__
    75     the_thread->rtems_ada_self = NULL;
    76   #endif
    77 
    78   the_thread->Start.tls_area = NULL;
    79   the_thread->Wait.spare_heads = NULL;
    8076
    8177  /*
     
    150146  _Thread_queue_Heads_initialize( the_thread->Wait.spare_heads );
    151147
    152   /*
    153    *  Initialize the thread timer
    154    */
    155   _Watchdog_Preinitialize( &the_thread->Timer );
    156 
    157148  #ifdef __RTEMS_STRICT_ORDER_MUTEX__
    158149    /* Initialize the head of chain of held mutexes */
    159150    _Chain_Initialize_empty(&the_thread->lock_mutex);
    160151  #endif
    161 
    162   /*
    163    * Clear the extensions area so extension users can determine
    164    * if they are linked to the thread. An extension user may
    165    * create the extension long after tasks have been created
    166    * so they cannot rely on the thread create user extension
    167    * call.  The object index starts with one, so the first extension context is
    168    * unused.
    169    */
    170   for ( i = 1 ; i <= rtems_configuration_get_maximum_extensions() ; ++i )
    171     the_thread->extensions[ i ] = NULL;
    172152
    173153  /*
     
    198178
    199179#if defined(RTEMS_SMP)
    200   the_thread->Scheduler.state = THREAD_SCHEDULER_BLOCKED;
     180  RTEMS_STATIC_ASSERT( THREAD_SCHEDULER_BLOCKED == 0, Scheduler_state );
    201181  the_thread->Scheduler.own_control = scheduler;
    202182  the_thread->Scheduler.control = scheduler;
    203183  the_thread->Scheduler.own_node = the_thread->Scheduler.node;
    204184  _Resource_Node_initialize( &the_thread->Resource_node );
    205   _CPU_Context_Set_is_executing( &the_thread->Registers, false );
    206185  the_thread->Lock.current = &the_thread->Lock.Default;
    207186  _SMP_ticket_lock_Initialize( &the_thread->Lock.Default );
    208187  _SMP_lock_Stats_initialize( &the_thread->Lock.Stats, "Thread Lock" );
    209188  _SMP_lock_Stats_initialize( &the_thread->Potpourri_stats, "Thread Potpourri" );
    210   _Atomic_Init_uint(&the_thread->Lock.generation, 0);
    211189#endif
    212190
     
    217195
    218196  the_thread->current_state           = STATES_DORMANT;
    219   the_thread->Wait.queue              = NULL;
    220197  the_thread->Wait.operations         = &_Thread_queue_Operations_default;
    221   the_thread->resource_count          = 0;
    222198  the_thread->current_priority        = priority;
    223199  the_thread->real_priority           = priority;
    224   the_thread->priority_generation     = 0;
    225200  the_thread->Start.initial_priority  = priority;
    226201
    227   _Thread_Wait_flags_set( the_thread, THREAD_WAIT_FLAGS_INITIAL );
     202  RTEMS_STATIC_ASSERT( THREAD_WAIT_FLAGS_INITIAL == 0, Wait_flags );
    228203
    229204  _Scheduler_Node_initialize( scheduler, the_thread );
     
    233208
    234209  /*
    235    *  Initialize the CPU usage statistics
    236    */
    237   _Timestamp_Set_to_zero( &the_thread->cpu_time_used );
    238 
    239   /*
    240210   * initialize thread's key vaule node chain
    241211   */
     
    244214  _Thread_Action_control_initialize( &the_thread->Post_switch_actions );
    245215
    246   _Thread_Action_initialize( &the_thread->Life.Action );
    247   the_thread->Life.state = THREAD_LIFE_NORMAL;
    248   the_thread->Life.terminator = NULL;
    249 
    250   the_thread->Capture.flags = 0;
    251   the_thread->Capture.control = NULL;
     216  RTEMS_STATIC_ASSERT( THREAD_LIFE_NORMAL == 0, Life_state );
    252217
    253218  /*
Note: See TracChangeset for help on using the changeset viewer.