source: rtems/cpukit/score/src/schedulerprioritytick.c @ f7f1d77

4.115
Last change on this file since f7f1d77 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#if HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <rtems/system.h>
15#include <rtems/score/schedulerpriority.h>
16
17void _Scheduler_priority_Tick( void )
18{
19  Thread_Control *executing;
20
21  executing = _Thread_Executing;
22
23  #ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__
24    /*
25     *  Increment the number of ticks this thread has been executing
26     */
27    executing->cpu_time_used++;
28  #endif
29
30  /*
31   *  If the thread is not preemptible or is not ready, then
32   *  just return.
33   */
34
35  if ( !executing->is_preemptible )
36    return;
37
38  if ( !_States_Is_ready( executing->current_state ) )
39    return;
40
41  /*
42   *  The cpu budget algorithm determines what happens next.
43   */
44
45  switch ( executing->budget_algorithm ) {
46    case THREAD_CPU_BUDGET_ALGORITHM_NONE:
47      break;
48
49    case THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE:
50    #if defined(RTEMS_SCORE_THREAD_ENABLE_EXHAUST_TIMESLICE)
51      case THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE:
52    #endif
53      if ( (int)(--executing->cpu_time_budget) <= 0 ) {
54
55        /*
56         *  A yield performs the ready chain mechanics needed when
57         *  resetting a timeslice.  If no other thread's are ready
58         *  at the priority of the currently executing thread, then the
59         *  executing thread's timeslice is reset.  Otherwise, the
60         *  currently executing thread is placed at the rear of the
61         *  FIFO for this priority and a new heir is selected.
62         */
63        _Scheduler_Yield();
64        executing->cpu_time_budget = _Thread_Ticks_per_timeslice;
65      }
66      break;
67
68    #if defined(RTEMS_SCORE_THREAD_ENABLE_SCHEDULER_CALLOUT)
69      case THREAD_CPU_BUDGET_ALGORITHM_CALLOUT:
70        if ( --executing->cpu_time_budget == 0 )
71          (*executing->budget_callout)( executing );
72        break;
73    #endif
74  }
75}
Note: See TracBrowser for help on using the repository browser.