source: rtems/cpukit/score/inline/rtems/score/scheduler.inl @ 6eba7c85

4.115
Last change on this file since 6eba7c85 was 6eba7c85, checked in by Sebastian Huber <sebastian.huber@…>, on 06/10/13 at 14:15:46

scheduler: Specify thread of yield operation

The yielding thread of the yield operation is now specified by a
parameter. The tick operation may be performed for each executing
thread in a SMP configuration.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/**
2 * @file
3 *
4 * @brief Inlined Routines Associated with the Manipulation of the Scheduler
5 *
6 * This inline file contains all of the inlined routines associated with
7 * the manipulation of the scheduler.
8 */
9
10/*
11 *  Copyright (C) 2010 Gedare Bloom.
12 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_SCHEDULER_H
20# error "Never use <rtems/score/scheduler.inl> directly; include <rtems/score/scheduler.h> instead."
21#endif
22
23#ifndef _RTEMS_SCORE_SCHEDULER_INL
24#define _RTEMS_SCORE_SCHEDULER_INL
25
26/**
27 * @addtogroup ScoreScheduler
28 */
29/**@{**/
30
31/**
32 * The preferred method to add a new scheduler is to define the jump table
33 * entries and add a case to the _Scheduler_Initialize routine.
34 *
35 * Generic scheduling implementations that rely on the ready queue only can
36 * be found in the _Scheduler_queue_XXX functions.
37 */
38
39/*
40 * Passing the Scheduler_Control* to these functions allows for multiple
41 * scheduler's to exist simultaneously, which could be useful on an SMP
42 * system.  Then remote Schedulers may be accessible.  How to protect such
43 * accesses remains an open problem.
44 */
45
46/**
47 * @brief Scheduler schedule.
48 *
49 * This kernel routine implements the scheduling decision logic for
50 * the scheduler. It does NOT dispatch.
51 */
52RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( void )
53{
54  _Scheduler.Operations.schedule();
55}
56
57/**
58 * @brief Scheduler yield with a particular thread.
59 *
60 * This routine is invoked when a thread wishes to voluntarily transfer control
61 * of the processor to another thread.
62 *
63 * @param[in] thread The yielding thread.
64 */
65RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
66  Thread_Control *thread
67)
68{
69  ( *_Scheduler.Operations.yield )( thread );
70}
71
72/**
73 * @brief Scheduler block.
74 *
75 * This routine removes @a the_thread from the scheduling decision for
76 * the scheduler. The primary task is to remove the thread from the
77 * ready queue.  It performs any necessary schedulering operations
78 * including the selection of a new heir thread.
79 */
80RTEMS_INLINE_ROUTINE void _Scheduler_Block(
81    Thread_Control    *the_thread
82)
83{
84  _Scheduler.Operations.block( the_thread );
85}
86
87/**
88 * @brief Scheduler unblock.
89 *
90 * This routine adds @a the_thread to the scheduling decision for
91 * the scheduler.  The primary task is to add the thread to the
92 * ready queue per the schedulering policy and update any appropriate
93 * scheduling variables, for example the heir thread.
94 */
95RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
96    Thread_Control    *the_thread
97)
98{
99  _Scheduler.Operations.unblock( the_thread );
100}
101
102/**
103 * @brief Scheduler allocate.
104 *
105 * This routine allocates @a the_thread->scheduler
106 */
107RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate(
108  Thread_Control    *the_thread
109)
110{
111  return _Scheduler.Operations.allocate( the_thread );
112}
113
114/**
115 * @brief Scheduler free.
116 *
117 * This routine frees @a the_thread->scheduler
118 */
119RTEMS_INLINE_ROUTINE void _Scheduler_Free(
120  Thread_Control    *the_thread
121)
122{
123  _Scheduler.Operations.free( the_thread );
124}
125
126/**
127 * @brief Scheduler update.
128 *
129 * This routine updates @a the_thread->scheduler
130 */
131RTEMS_INLINE_ROUTINE void _Scheduler_Update(
132  Thread_Control    *the_thread
133)
134{
135  _Scheduler.Operations.update( the_thread );
136}
137
138/**
139 * @brief Scheduler enqueue.
140 *
141 * This routine enqueue @a the_thread->scheduler
142 */
143RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(
144  Thread_Control    *the_thread
145)
146{
147  _Scheduler.Operations.enqueue( the_thread );
148}
149
150/**
151 * @brief Scheduler enqueue first.
152 *
153 * This routine enqueue_first @a the_thread->scheduler
154 */
155RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(
156  Thread_Control    *the_thread
157)
158{
159  _Scheduler.Operations.enqueue_first( the_thread );
160}
161
162/**
163 * @brief Scheduler extract.
164 *
165 * This routine extract @a the_thread->scheduler
166 */
167RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
168  Thread_Control    *the_thread
169)
170{
171  _Scheduler.Operations.extract( the_thread );
172}
173
174/**
175 * @brief Scheduler priority compare.
176 *
177 * This routine compares two priorities.
178 */
179RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
180  Priority_Control p1,
181  Priority_Control p2
182)
183{
184  return _Scheduler.Operations.priority_compare(p1, p2);
185}
186
187/**
188 * @brief Scheduler release job.
189 *
190 * This routine is called when a new period of task is issued.
191 */
192RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
193  Thread_Control *the_thread,
194  uint32_t       length
195)
196{
197  _Scheduler.Operations.release_job(the_thread, length);
198}
199
200/**
201 * @brief Scheduler method invoked at each clock tick.
202 *
203 * This method is invoked at each clock tick to allow the scheduler
204 * implementation to perform any activities required.  For the
205 * scheduler which support standard RTEMS features, this includes
206 * time-slicing management.
207 */
208RTEMS_INLINE_ROUTINE void _Scheduler_Tick( void )
209{
210  _Scheduler.Operations.tick();
211}
212
213/**
214 * @brief Starts the idle thread for a particular processor.
215 *
216 * @param[in/out] thread The idle thread for the processor.
217 * @parma[in/out] processor The processor for the idle thread.
218 *
219 * @see _Thread_Create_idle().
220 */
221RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
222  Thread_Control *thread,
223  Per_CPU_Control *processor
224)
225{
226  ( *_Scheduler.Operations.start_idle )( thread, processor );
227}
228
229/** @} */
230
231#endif
232/* end of include file */
Note: See TracBrowser for help on using the repository browser.