RTEMS
schedulersimpleimpl.h
Go to the documentation of this file.
1 
13 /*
14  * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
15  *
16  * The license and distribution terms for this file may be
17  * found in the file LICENSE in this distribution or at
18  * http://www.rtems.org/license/LICENSE.
19  */
20 
21 #ifndef _RTEMS_SCORE_SCHEDULERSIMPLEIMPL_H
22 #define _RTEMS_SCORE_SCHEDULERSIMPLEIMPL_H
23 
25 #include <rtems/score/chainimpl.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
47 {
48  return (Scheduler_simple_Context *) _Scheduler_Get_context( scheduler );
49 }
50 
61  const void *to_insert,
62  const Chain_Node *next
63 )
64 {
65  const unsigned int *priority_to_insert;
66  const Thread_Control *thread_next;
67 
68  priority_to_insert = (const unsigned int *) to_insert;
69  thread_next = (const Thread_Control *) next;
70 
71  return *priority_to_insert <= _Thread_Get_priority( thread_next );
72 }
73 
82  Chain_Control *chain,
83  Thread_Control *to_insert,
84  unsigned int insert_priority
85 )
86 {
88  chain,
89  &to_insert->Object.Node,
90  &insert_priority,
92  );
93 }
94 
103  const Scheduler_Control *scheduler,
104  Thread_Control *the_thread,
105  Scheduler_Node *node
106 )
107 {
108  (void) scheduler;
109  (void) node;
110 
111  _Chain_Extract_unprotected( &the_thread->Object.Node );
112 }
113 
125  const Scheduler_Control *scheduler,
126  Thread_Control *the_thread,
127  bool force_dispatch
128 )
129 {
130  Scheduler_simple_Context *context =
131  _Scheduler_simple_Get_context( scheduler );
132  Thread_Control *heir = (Thread_Control *) _Chain_First( &context->Ready );
133 
134  ( void ) the_thread;
135 
136  _Scheduler_Update_heir( heir, force_dispatch );
137 }
138 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif
146 /* end of include file */
static __inline__ Chain_Node * _Chain_First(const Chain_Control *the_chain)
Returns pointer to chain&#39;s first node.
Definition: chainimpl.h:260
Chain_Control Ready
One ready queue for all ready threads.
static __inline__ void _Scheduler_simple_Extract(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Extracts the threads node.
Inlined Routines Associated with the Manipulation of the Scheduler.
static __inline__ void _Scheduler_simple_Schedule_body(const Scheduler_Control *scheduler, Thread_Control *the_thread, bool force_dispatch)
Scheduling decision logic.
Simple scheduler context.
static __inline__ void _Scheduler_Update_heir(Thread_Control *new_heir, bool force_dispatch)
Updates the heir.
Manipulation of Threads Simple-Priority-Based Ready Queue.
Chain_Node Node
Definition: objectdata.h:41
Objects_Control Object
Definition: thread.h:727
static __inline__ void _Chain_Extract_unprotected(Chain_Node *the_node)
Extracts this node (unprotected).
Definition: chainimpl.h:558
static __inline__ Priority_Control _Thread_Get_priority(const Thread_Control *the_thread)
Returns the priority of the thread.
Definition: threadimpl.h:1610
static __inline__ Scheduler_simple_Context * _Scheduler_simple_Get_context(const Scheduler_Control *scheduler)
Gets context of the scheduler.
Chain Handler API.
static __inline__ void _Scheduler_simple_Insert(Chain_Control *chain, Thread_Control *to_insert, unsigned int insert_priority)
Inserts the thread control with the given priority into the chain.
Scheduler control.
Definition: scheduler.h:264
Scheduler node for per-thread data.
Definition: schedulernode.h:79
static __inline__ Scheduler_Context * _Scheduler_Get_context(const Scheduler_Control *scheduler)
Gets the context of the scheduler.
Definition: schedulerimpl.h:85
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
Definition: basedefs.h:683
static __inline__ void _Chain_Insert_ordered_unprotected(Chain_Control *the_chain, Chain_Node *to_insert, const void *left, Chain_Node_order order)
Inserts a node into the chain according to the order relation.
Definition: chainimpl.h:864
static __inline__ bool _Scheduler_simple_Priority_less_equal(const void *to_insert, const Chain_Node *next)
Checks if the priority is less or equal than the priority of the node.