Changeset 8e467384 in rtems


Ignore:
Timestamp:
Jun 3, 2014, 8:29:30 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
4d1f500
Parents:
f6fc6359
git-author:
Sebastian Huber <sebastian.huber@…> (06/03/14 08:29:30)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/04/14 06:37:06)
Message:

score: Replace _Scheduler_Allocate/Free()

Replace _Scheduler_Allocate() with _Scheduler_Node_initialize(). Remove
the return status and thus the node initialization must be always
successful.

Rename _Scheduler_Free() to _Scheduler_Node_destroy().

Location:
cpukit/score
Files:
1 added
15 edited
3 moved

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    rf6fc6359 r8e467384  
    205205libscore_a_SOURCES += src/schedulergetaffinity.c
    206206libscore_a_SOURCES += src/schedulersetaffinity.c
    207 libscore_a_SOURCES += src/schedulerdefaultallocatefree.c
     207libscore_a_SOURCES += src/schedulerdefaultnodedestroy.c
     208libscore_a_SOURCES += src/schedulerdefaultnodeinit.c
    208209libscore_a_SOURCES += src/schedulerdefaultreleasejob.c
    209210libscore_a_SOURCES += src/schedulerdefaultschedule.c
     
    232233## SCHEDULEREDF_C_FILES
    233234libscore_a_SOURCES += src/scheduleredf.c \
    234     src/scheduleredfallocate.c \
     235    src/scheduleredfnodeinit.c \
    235236    src/scheduleredfblock.c \
    236237    src/scheduleredfchangepriority.c \
     
    244245## SCHEDULERCBS_C_FILES
    245246libscore_a_SOURCES += src/schedulercbs.c \
    246     src/schedulercbsallocate.c \
     247    src/schedulercbsnodeinit.c \
    247248    src/schedulercbsattachthread.c \
    248249    src/schedulercbscleanup.c \
  • cpukit/score/include/rtems/score/scheduler.h

    rf6fc6359 r8e467384  
    7272  );
    7373
    74   /** @see _Scheduler_Allocate() */
    75   bool ( *allocate )( const Scheduler_Control *, Thread_Control * );
    76 
    77   /** @see _Scheduler_Free() */
    78   void ( *free )( const Scheduler_Control *, Thread_Control * );
     74  /** @see _Scheduler_Node_initialize() */
     75  void ( *node_initialize )( const Scheduler_Control *, Thread_Control * );
     76
     77  /** @see _Scheduler_Node_destroy() */
     78  void ( *node_destroy )( const Scheduler_Control *, Thread_Control * );
    7979
    8080  /** @see _Scheduler_Update() */
     
    252252
    253253/**
    254  * @brief Returns true.
    255  *
    256  * @param[in] scheduler Unused.
    257  * @param[in] the_thread Unused.
    258  *
    259  * @retval true Always.
    260  */
    261 bool _Scheduler_default_Allocate(
     254 * @brief Does nothing.
     255 *
     256 * @param[in] scheduler Unused.
     257 * @param[in] the_thread Unused.
     258 */
     259void _Scheduler_default_Node_initialize(
    262260  const Scheduler_Control *scheduler,
    263261  Thread_Control          *the_thread
     
    270268 * @param[in] the_thread Unused.
    271269 */
    272 void _Scheduler_default_Free(
     270void _Scheduler_default_Node_destroy(
    273271  const Scheduler_Control *scheduler,
    274272  Thread_Control          *the_thread
  • cpukit/score/include/rtems/score/schedulercbs.h

    rf6fc6359 r8e467384  
    5454    _Scheduler_CBS_Unblock,          /* unblock entry point */ \
    5555    _Scheduler_EDF_Change_priority,  /* change priority entry point */ \
    56     _Scheduler_CBS_Allocate,         /* allocate entry point */ \
    57     _Scheduler_default_Free,         /* free entry point */ \
     56    _Scheduler_CBS_Node_initialize,  /* node initialize entry point */ \
     57    _Scheduler_default_Node_destroy, /* node destroy entry point */ \
    5858    _Scheduler_EDF_Update,           /* update entry point */ \
    5959    _Scheduler_EDF_Priority_compare, /* compares two priorities */ \
     
    336336
    337337/**
    338  *  @brief Allocates CBS specific information of @a the_thread.
    339  *
    340  *  This routine allocates CBS specific information of @a the_thread.
    341  *
    342  *  @param[in] the_thread is the thread the scheduler is allocating
    343  *             management memory for.
    344  */
    345 bool _Scheduler_CBS_Allocate(
     338 *  @brief Initializes a CBS specific scheduler node of @a the_thread.
     339 */
     340void _Scheduler_CBS_Node_initialize(
    346341  const Scheduler_Control *scheduler,
    347342  Thread_Control          *the_thread
  • cpukit/score/include/rtems/score/scheduleredf.h

    rf6fc6359 r8e467384  
    4747    _Scheduler_EDF_Unblock,          /* unblock entry point */ \
    4848    _Scheduler_EDF_Change_priority,  /* change priority entry point */ \
    49     _Scheduler_EDF_Allocate,         /* allocate entry point */ \
    50     _Scheduler_default_Free,         /* free entry point */ \
     49    _Scheduler_EDF_Node_initialize,  /* node initialize entry point */ \
     50    _Scheduler_default_Node_destroy, /* node destroy entry point */ \
    5151    _Scheduler_EDF_Update,           /* update entry point */ \
    5252    _Scheduler_EDF_Priority_compare, /* compares two priorities */ \
     
    147147
    148148/**
    149  *  @brief Allocates EDF specific information of @a the_thread.
    150  *
    151  *  This routine allocates EDF specific information of @a the_thread.
    152  *
    153  *  @param[in] the_thread is the thread the scheduler is allocating
    154  *             management memory for.
    155  */
    156 bool _Scheduler_EDF_Allocate(
     149 *  @brief Initializes an EDF specific scheduler node of @a the_thread.
     150 */
     151void _Scheduler_EDF_Node_initialize(
    157152  const Scheduler_Control *scheduler,
    158153  Thread_Control          *the_thread
  • cpukit/score/include/rtems/score/schedulerimpl.h

    rf6fc6359 r8e467384  
    174174
    175175/**
    176  * @brief Scheduler allocate.
    177  *
    178  * This routine allocates @a the_thread->scheduler
    179  */
    180 RTEMS_INLINE_ROUTINE bool _Scheduler_Allocate(
     176 * @brief Initializes a scheduler node.
     177 *
     178 * The scheduler node contains arbitrary data on function entry.  The caller
     179 * must ensure that _Scheduler_Node_destroy() will be called after a
     180 * _Scheduler_Node_initialize() before the memory of the scheduler node is
     181 * destroyed.
     182 *
     183 * @param[in] scheduler The scheduler instance.
     184 * @param[in] the_thread The thread containing the scheduler node.
     185 */
     186RTEMS_INLINE_ROUTINE void _Scheduler_Node_initialize(
    181187  const Scheduler_Control *scheduler,
    182188  Thread_Control          *the_thread
    183189)
    184190{
    185   return ( *scheduler->Operations.allocate )( scheduler, the_thread );
    186 }
    187 
    188 /**
    189  * @brief Scheduler free.
    190  *
    191  * This routine frees @a the_thread->scheduler
    192  */
    193 RTEMS_INLINE_ROUTINE void _Scheduler_Free(
     191  return ( *scheduler->Operations.node_initialize )( scheduler, the_thread );
     192}
     193
     194/**
     195 * @brief Destroys a scheduler node.
     196 *
     197 * The caller must ensure that _Scheduler_Node_destroy() will be called only
     198 * after a corresponding _Scheduler_Node_initialize().
     199 *
     200 * @param[in] scheduler The scheduler instance.
     201 * @param[in] the_thread The thread containing the scheduler node.
     202 */
     203RTEMS_INLINE_ROUTINE void _Scheduler_Node_destroy(
    194204  const Scheduler_Control *scheduler,
    195205  Thread_Control          *the_thread
    196206)
    197207{
    198   ( *scheduler->Operations.free )( scheduler, the_thread );
     208  ( *scheduler->Operations.node_destroy )( scheduler, the_thread );
    199209}
    200210
     
    355365  if ( current_scheduler != scheduler ) {
    356366    _Thread_Set_state( the_thread, STATES_MIGRATING );
    357     _Scheduler_Free( current_scheduler, the_thread );
     367    _Scheduler_Node_destroy( current_scheduler, the_thread );
    358368    the_thread->scheduler = scheduler;
    359     _Scheduler_Allocate( scheduler, the_thread );
     369    _Scheduler_Node_initialize( scheduler, the_thread );
    360370    _Scheduler_Update( scheduler, the_thread );
    361371    _Thread_Clear_state( the_thread, STATES_MIGRATING );
  • cpukit/score/include/rtems/score/schedulerpriority.h

    rf6fc6359 r8e467384  
    5454    _Scheduler_priority_Unblock,          /* unblock entry point */ \
    5555    _Scheduler_priority_Change_priority,  /* change priority entry point */ \
    56     _Scheduler_default_Allocate,          /* allocate entry point */ \
    57     _Scheduler_default_Free,              /* free entry point */ \
     56    _Scheduler_default_Node_initialize,   /* node initialize entry point */ \
     57    _Scheduler_default_Node_destroy,      /* node destroy entry point */ \
    5858    _Scheduler_priority_Update,           /* update entry point */ \
    5959    _Scheduler_priority_Priority_compare, /* compares two priorities */ \
  • cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h

    rf6fc6359 r8e467384  
    5656    _Scheduler_priority_SMP_Unblock, \
    5757    _Scheduler_priority_SMP_Change_priority, \
    58     _Scheduler_priority_affinity_SMP_Allocate, \
    59     _Scheduler_default_Free, \
     58    _Scheduler_priority_affinity_SMP_Node_initialize, \
     59    _Scheduler_default_Node_destroy, \
    6060    _Scheduler_priority_SMP_Update, \
    6161    _Scheduler_priority_Priority_compare, \
     
    7676 *             management memory for.
    7777 */
    78 bool _Scheduler_priority_affinity_SMP_Allocate(
     78void _Scheduler_priority_affinity_SMP_Node_initialize(
    7979  const Scheduler_Control *scheduler,
    8080  Thread_Control          *the_thread
  • cpukit/score/include/rtems/score/schedulerprioritysmp.h

    rf6fc6359 r8e467384  
    8585    _Scheduler_priority_SMP_Unblock, \
    8686    _Scheduler_priority_SMP_Change_priority, \
    87     _Scheduler_priority_SMP_Allocate, \
    88     _Scheduler_default_Free, \
     87    _Scheduler_priority_SMP_Node_initialize, \
     88    _Scheduler_default_Node_destroy, \
    8989    _Scheduler_priority_SMP_Update, \
    9090    _Scheduler_priority_Priority_compare, \
     
    9898void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler );
    9999
    100 bool _Scheduler_priority_SMP_Allocate(
     100void _Scheduler_priority_SMP_Node_initialize(
    101101  const Scheduler_Control *scheduler,
    102102  Thread_Control *thread
  • cpukit/score/include/rtems/score/schedulersimple.h

    rf6fc6359 r8e467384  
    4444    _Scheduler_simple_Unblock,            /* unblock entry point */ \
    4545    _Scheduler_simple_Change_priority,    /* change priority entry point */ \
    46     _Scheduler_default_Allocate,          /* allocate entry point */ \
    47     _Scheduler_default_Free,              /* free entry point */ \
     46    _Scheduler_default_Node_initialize,   /* node initialize entry point */ \
     47    _Scheduler_default_Node_destroy,      /* node destroy entry point */ \
    4848    _Scheduler_default_Update,            /* update entry point */ \
    4949    _Scheduler_priority_Priority_compare, /* compares two priorities */ \
  • cpukit/score/include/rtems/score/schedulersimplesmp.h

    rf6fc6359 r8e467384  
    6666    _Scheduler_simple_SMP_Unblock, \
    6767    _Scheduler_simple_SMP_Change_priority, \
    68     _Scheduler_simple_SMP_Allocate, \
    69     _Scheduler_default_Free, \
     68    _Scheduler_simple_SMP_Node_initialize, \
     69    _Scheduler_default_Node_destroy, \
    7070    _Scheduler_default_Update, \
    7171    _Scheduler_priority_Priority_compare, \
     
    7979void _Scheduler_simple_SMP_Initialize( const Scheduler_Control *scheduler );
    8080
    81 bool _Scheduler_simple_SMP_Allocate(
     81void _Scheduler_simple_SMP_Node_initialize(
    8282  const Scheduler_Control *scheduler,
    8383  Thread_Control          *the_thread
  • cpukit/score/src/schedulercbsnodeinit.c

    rf6fc6359 r8e467384  
    2121#include <rtems/score/schedulercbsimpl.h>
    2222
    23 bool _Scheduler_CBS_Allocate(
     23void _Scheduler_CBS_Node_initialize(
    2424  const Scheduler_Control *scheduler,
    25   Thread_Control    *the_thread
     25  Thread_Control          *the_thread
    2626)
    2727{
     
    3333  node->Base.queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
    3434  node->cbs_server = NULL;
    35 
    36   return true;
    3735}
  • cpukit/score/src/schedulerdefaultnodeinit.c

    rf6fc6359 r8e467384  
    22 * @file
    33 *
    4  * @brief Scheduler Default Allocate and Release Operation
     4 * @brief Scheduler Default Node Initialization Operation
    55 *
    66 * @ingroup ScoreScheduler
     
    2222#include <rtems/score/scheduler.h>
    2323
    24 bool _Scheduler_default_Allocate(
     24void _Scheduler_default_Node_initialize(
    2525  const Scheduler_Control *scheduler,
    2626  Thread_Control          *the_thread
    2727)
    2828{
    29   ( void ) scheduler;
    30   ( void ) the_thread;
    31 
    32   return true;
     29  (void) scheduler;
     30  (void) the_thread;
    3331}
    34 
    35 void _Scheduler_default_Free(
    36   const Scheduler_Control *scheduler,
    37   Thread_Control          *the_thread
    38 )
    39 {
    40   ( void ) scheduler;
    41   ( void ) the_thread;
    42 }
  • cpukit/score/src/scheduleredfnodeinit.c

    rf6fc6359 r8e467384  
    2121#include <rtems/score/scheduleredfimpl.h>
    2222
    23 bool _Scheduler_EDF_Allocate(
     23void _Scheduler_EDF_Node_initialize(
    2424  const Scheduler_Control *scheduler,
    2525  Thread_Control          *the_thread
     
    3232  node->thread = the_thread;
    3333  node->queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
    34 
    35   return true;
    3634}
  • cpukit/score/src/schedulerpriorityaffinitysmp.c

    rf6fc6359 r8e467384  
    3333}
    3434
    35 bool _Scheduler_priority_affinity_SMP_Allocate(
     35void _Scheduler_priority_affinity_SMP_Node_initialize(
    3636  const Scheduler_Control *scheduler,
    3737  Thread_Control          *the_thread
     
    4545  node->Affinity = *_CPU_set_Default();
    4646  node->Affinity.set = &node->Affinity.preallocated;
    47 
    48   return true;
    4947}
    5048
  • cpukit/score/src/schedulerprioritysmp.c

    rf6fc6359 r8e467384  
    6565}
    6666
    67 bool _Scheduler_priority_SMP_Allocate(
     67void _Scheduler_priority_SMP_Node_initialize(
    6868  const Scheduler_Control *scheduler,
    6969  Thread_Control *thread
     
    7373
    7474  _Scheduler_SMP_Node_initialize( node );
    75 
    76   return true;
    7775}
    7876
  • cpukit/score/src/schedulersimplesmp.c

    rf6fc6359 r8e467384  
    4343}
    4444
    45 bool _Scheduler_simple_SMP_Allocate(
     45void _Scheduler_simple_SMP_Node_initialize(
    4646  const Scheduler_Control *scheduler,
    4747  Thread_Control          *the_thread
     
    5151
    5252  _Scheduler_SMP_Node_initialize( node );
    53 
    54   return true;
    5553}
    5654
  • cpukit/score/src/threadinitialize.c

    rf6fc6359 r8e467384  
    5353  bool                     extension_status;
    5454  size_t                   i;
    55   bool                     scheduler_allocated = false;
     55  bool                     scheduler_node_initialized = false;
    5656  Per_CPU_Control         *cpu = _Per_CPU_Get_by_index( 0 );
    5757
     
    199199  the_thread->Start.initial_priority  = priority;
    200200
    201   scheduler_allocated = _Scheduler_Allocate( scheduler, the_thread );
    202   if ( !scheduler_allocated ) {
    203     goto failed;
    204   }
     201  _Scheduler_Node_initialize( scheduler, the_thread );
     202  scheduler_node_initialized = true;
    205203
    206204  _Thread_Set_priority( the_thread, priority );
     
    247245failed:
    248246
    249   if ( scheduler_allocated ) {
    250     _Scheduler_Free( scheduler, the_thread );
     247  if ( scheduler_node_initialized ) {
     248    _Scheduler_Node_destroy( scheduler, the_thread );
    251249  }
    252250
  • cpukit/score/src/threadrestart.c

    rf6fc6359 r8e467384  
    7272   * Free the per-thread scheduling information.
    7373   */
    74   _Scheduler_Free( _Scheduler_Get( the_thread ), the_thread );
     74  _Scheduler_Node_destroy( _Scheduler_Get( the_thread ), the_thread );
    7575
    7676  /*
Note: See TracChangeset for help on using the changeset viewer.