Changeset 3ba0750 in rtems


Ignore:
Timestamp:
Jul 6, 2009, 5:59:34 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
147c5d5
Parents:
69ca55c0
Message:

2009-07-06 Joel Sherrill <joel.sherrill@…>

  • posix/src/psxtransschedparam.c: Restructure to avoid untestable code being generated by switch.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r69ca55c0 r3ba0750  
     12009-07-06      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        * posix/src/psxtransschedparam.c: Restructure to avoid untestable code
     4        being generated by switch.
     5
    162009-07-06      Joel Sherrill <joel.sherrill@OARcorp.com>
    27
  • cpukit/posix/src/psxtransschedparam.c

    r69ca55c0 r3ba0750  
    3434  *budget_callout = NULL;
    3535
    36   switch ( policy ) {
    37     case SCHED_OTHER:
    38       *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE;
    39       break;
     36  if ( policy == SCHED_OTHER ) {
     37    *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE;
     38    return 0;
     39  }
    4040
    41     case SCHED_FIFO:
    42       *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE;
    43       break;
     41  if ( policy == SCHED_FIFO ) {
     42    *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE;
     43    return 0;
     44  }
    4445
    45     case SCHED_RR:
    46       *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE;
    47       break;
     46  if ( policy == SCHED_RR ) {
     47    *budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE;
     48    return 0;
     49  }
    4850
    49     case SCHED_SPORADIC:
    50       *budget_algorithm  = THREAD_CPU_BUDGET_ALGORITHM_CALLOUT;
    51       *budget_callout = _POSIX_Threads_Sporadic_budget_callout;
     51  if ( policy == SCHED_SPORADIC ) {
     52    if ( _Timespec_To_ticks( &param->ss_replenish_period ) <
     53         _Timespec_To_ticks( &param->ss_initial_budget ) )
     54      return EINVAL;
    5255
    53       if ( _Timespec_To_ticks( &param->ss_replenish_period ) <
    54            _Timespec_To_ticks( &param->ss_initial_budget ) )
    55         return EINVAL;
     56    if ( !_POSIX_Priority_Is_valid( param->ss_low_priority ) )
     57      return EINVAL;
     58   
     59    *budget_algorithm  = THREAD_CPU_BUDGET_ALGORITHM_CALLOUT;
     60    *budget_callout = _POSIX_Threads_Sporadic_budget_callout;
     61    return 0;
     62  }
    5663
    57       if ( !_POSIX_Priority_Is_valid( param->ss_low_priority ) )
    58         return EINVAL;
    59       break;
    60 
    61     default:
    62       return EINVAL;
    63   }
    64   return 0;
     64  return EINVAL;
    6565}
Note: See TracChangeset for help on using the changeset viewer.