Changeset 2014063 in rtems


Ignore:
Timestamp:
08/07/96 22:06:08 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
3fd3da4
Parents:
ecc912f4
Message:

sporadic server debugged and working. This required minor changes in all
sporadic server related routines.

Files:
2 edited

Legend:

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

    recc912f4 r2014063  
    5353)
    5454{
     55  unsigned32          ticks;
     56  unsigned32          new_priority;
    5557  Thread_Control     *the_thread;
    5658  POSIX_API_Control  *api;
     
    6062  api = the_thread->API_Extensions[ THREAD_API_POSIX ];
    6163
    62   the_thread->cpu_time_budget =
    63     _POSIX_Timespec_to_interval( &api->schedparam.ss_initial_budget );
    64 
    65   _Thread_Change_priority(
    66     the_thread,
    67     _POSIX_Priority_To_core( api->schedparam.sched_priority )
    68   );
     64  ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_initial_budget );
     65
     66  if ( !ticks )
     67    ticks = 1;
     68
     69  the_thread->cpu_time_budget = ticks;
    6970 
    70   _Watchdog_Insert_ticks(
    71     &api->Sporadic_timer,
    72     _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period )
    73   );
     71  new_priority = _POSIX_Priority_To_core( api->ss_high_priority );
     72  the_thread->real_priority = new_priority;
     73
     74  if ( the_thread->resource_count == 0 ||
     75       the_thread->current_priority > new_priority )
     76    _Thread_Change_priority( the_thread, new_priority );
     77
     78  ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period );
     79
     80  if ( !ticks )
     81    ticks = 1;
     82
     83  _Watchdog_Insert_ticks( &api->Sporadic_timer, ticks );
    7484}
    7585
     
    8393)
    8494{
    85   POSIX_API_Control                  *api;
    86 
    87   api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
    88 
    89   /* XXX really should be based on MAX_U32 */
    90 
    91   the_thread->cpu_time_budget = 0xFFFFFFFF;
    92 
    93   _Thread_Change_priority(
    94     the_thread,
    95     _POSIX_Priority_To_core( api->schedparam.ss_low_priority )
    96   );
     95  POSIX_API_Control *api;
     96  unsigned32         new_priority;
     97
     98  api = the_thread->API_Extensions[ THREAD_API_POSIX ];
     99
     100  /*
     101   *  This will prevent the thread from consuming its entire "budget"
     102   *  while at low priority.
     103   */
     104
     105
     106  the_thread->cpu_time_budget = 0xFFFFFFFF; /* XXX should be based on MAX_U32 */
     107
     108  new_priority = _POSIX_Priority_To_core( api->schedparam.ss_low_priority );
     109  the_thread->real_priority = new_priority;
     110
     111 if ( the_thread->resource_count == 0 ||
     112      the_thread->current_priority > new_priority )
     113    _Thread_Change_priority( the_thread, new_priority );
    97114}
    98115
     
    465482)
    466483{
    467   if ( !attr || !attr->is_initialized )
     484  if ( !attr || !attr->is_initialized || !param )
    468485    return EINVAL;
    469486
     
    482499)
    483500{
    484   if ( !attr || !attr->is_initialized )
     501  if ( !attr || !attr->is_initialized || !param )
    485502    return EINVAL;
    486503
     
    517534      *policy = api->schedpolicy;
    518535      *param  = api->schedparam;
     536      param->sched_priority =
     537        _POSIX_Priority_From_core( the_thread->current_priority );
    519538      _Thread_Enable_dispatch();
    520539      return 0;
     
    619638 
    620639        case SCHED_SPORADIC:
     640          api->ss_high_priority = api->schedparam.sched_priority;
    621641          _POSIX_Threads_Sporadic_budget_TSR( 0, the_thread );
    622642          break;
  • cpukit/posix/src/pthread.c

    recc912f4 r2014063  
    5353)
    5454{
     55  unsigned32          ticks;
     56  unsigned32          new_priority;
    5557  Thread_Control     *the_thread;
    5658  POSIX_API_Control  *api;
     
    6062  api = the_thread->API_Extensions[ THREAD_API_POSIX ];
    6163
    62   the_thread->cpu_time_budget =
    63     _POSIX_Timespec_to_interval( &api->schedparam.ss_initial_budget );
    64 
    65   _Thread_Change_priority(
    66     the_thread,
    67     _POSIX_Priority_To_core( api->schedparam.sched_priority )
    68   );
     64  ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_initial_budget );
     65
     66  if ( !ticks )
     67    ticks = 1;
     68
     69  the_thread->cpu_time_budget = ticks;
    6970 
    70   _Watchdog_Insert_ticks(
    71     &api->Sporadic_timer,
    72     _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period )
    73   );
     71  new_priority = _POSIX_Priority_To_core( api->ss_high_priority );
     72  the_thread->real_priority = new_priority;
     73
     74  if ( the_thread->resource_count == 0 ||
     75       the_thread->current_priority > new_priority )
     76    _Thread_Change_priority( the_thread, new_priority );
     77
     78  ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period );
     79
     80  if ( !ticks )
     81    ticks = 1;
     82
     83  _Watchdog_Insert_ticks( &api->Sporadic_timer, ticks );
    7484}
    7585
     
    8393)
    8494{
    85   POSIX_API_Control                  *api;
    86 
    87   api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
    88 
    89   /* XXX really should be based on MAX_U32 */
    90 
    91   the_thread->cpu_time_budget = 0xFFFFFFFF;
    92 
    93   _Thread_Change_priority(
    94     the_thread,
    95     _POSIX_Priority_To_core( api->schedparam.ss_low_priority )
    96   );
     95  POSIX_API_Control *api;
     96  unsigned32         new_priority;
     97
     98  api = the_thread->API_Extensions[ THREAD_API_POSIX ];
     99
     100  /*
     101   *  This will prevent the thread from consuming its entire "budget"
     102   *  while at low priority.
     103   */
     104
     105
     106  the_thread->cpu_time_budget = 0xFFFFFFFF; /* XXX should be based on MAX_U32 */
     107
     108  new_priority = _POSIX_Priority_To_core( api->schedparam.ss_low_priority );
     109  the_thread->real_priority = new_priority;
     110
     111 if ( the_thread->resource_count == 0 ||
     112      the_thread->current_priority > new_priority )
     113    _Thread_Change_priority( the_thread, new_priority );
    97114}
    98115
     
    465482)
    466483{
    467   if ( !attr || !attr->is_initialized )
     484  if ( !attr || !attr->is_initialized || !param )
    468485    return EINVAL;
    469486
     
    482499)
    483500{
    484   if ( !attr || !attr->is_initialized )
     501  if ( !attr || !attr->is_initialized || !param )
    485502    return EINVAL;
    486503
     
    517534      *policy = api->schedpolicy;
    518535      *param  = api->schedparam;
     536      param->sched_priority =
     537        _POSIX_Priority_From_core( the_thread->current_priority );
    519538      _Thread_Enable_dispatch();
    520539      return 0;
     
    619638 
    620639        case SCHED_SPORADIC:
     640          api->ss_high_priority = api->schedparam.sched_priority;
    621641          _POSIX_Threads_Sporadic_budget_TSR( 0, the_thread );
    622642          break;
Note: See TracChangeset for help on using the changeset viewer.