source: rtems/cpukit/score/include/rtems/score/schedulersimpleimpl.h @ e382a1b

5
Last change on this file since e382a1b was e382a1b, checked in by Sebastian Huber <sebastian.huber@…>, on 10/10/16 at 12:33:17

score: Pass scheduler node to block operation

Changed for consistency with other scheduler operations.

Update #2556.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/**
2 * @file
3 *
4 * @brief Inlined Routines Associated with the Manipulation of the
5 * Priority-Based Scheduling Structures
6 *
7 * This inline file contains all of the inlined routines associated with
8 * the manipulation of the priority-based scheduling structures.
9 */
10
11/*
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.org/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_SCHEDULERSIMPLEIMPL_H
20#define _RTEMS_SCORE_SCHEDULERSIMPLEIMPL_H
21
22#include <rtems/score/schedulersimple.h>
23#include <rtems/score/chainimpl.h>
24#include <rtems/score/schedulerimpl.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/**
31 * @addtogroup ScoreSchedulerSimple
32 */
33/**@{**/
34
35RTEMS_INLINE_ROUTINE Scheduler_simple_Context *
36  _Scheduler_simple_Get_context( const Scheduler_Control *scheduler )
37{
38  return (Scheduler_simple_Context *) _Scheduler_Get_context( scheduler );
39}
40
41RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_lifo_order(
42  const Chain_Node *to_insert,
43  const Chain_Node *next
44)
45{
46  const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
47  const Thread_Control *thread_next = (const Thread_Control *) next;
48
49  return _Thread_Get_priority( thread_to_insert )
50    <= _Thread_Get_priority( thread_next );
51}
52
53RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order(
54  const Chain_Node *to_insert,
55  const Chain_Node *next
56)
57{
58  const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
59  const Thread_Control *thread_next = (const Thread_Control *) next;
60
61  return _Thread_Get_priority( thread_to_insert )
62    < _Thread_Get_priority( thread_next );
63}
64
65RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_lifo(
66  Chain_Control *chain,
67  Thread_Control *to_insert
68)
69{
70  _Chain_Insert_ordered_unprotected(
71    chain,
72    &to_insert->Object.Node,
73    _Scheduler_simple_Insert_priority_lifo_order
74  );
75}
76
77RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo(
78  Chain_Control *chain,
79  Thread_Control *to_insert
80)
81{
82  _Chain_Insert_ordered_unprotected(
83    chain,
84    &to_insert->Object.Node,
85    _Scheduler_simple_Insert_priority_fifo_order
86  );
87}
88
89RTEMS_INLINE_ROUTINE void _Scheduler_simple_Extract(
90  const Scheduler_Control *scheduler,
91  Thread_Control          *the_thread,
92  Scheduler_Node          *node
93)
94{
95  (void) scheduler;
96  (void) node;
97
98  _Chain_Extract_unprotected( &the_thread->Object.Node );
99}
100
101RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body(
102  const Scheduler_Control *scheduler,
103  Thread_Control          *the_thread,
104  bool                     force_dispatch
105)
106{
107  Scheduler_simple_Context *context =
108    _Scheduler_simple_Get_context( scheduler );
109  Thread_Control *heir = (Thread_Control *) _Chain_First( &context->Ready );
110
111  ( void ) the_thread;
112
113  _Scheduler_Update_heir( heir, force_dispatch );
114}
115
116/** @} */
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif
123/* end of include file */
Note: See TracBrowser for help on using the repository browser.