RTEMS: cpukit/include/rtems/score/schedulersimpleimpl.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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
24#include <rtems/score/schedulersimple.h>
25#include <rtems/score/chainimpl.h>
26#include <rtems/score/schedulerimpl.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
45 RTEMS_INLINE_ROUTINE Scheduler_simple_Context *
46 _Scheduler_simple_Get_context( const Scheduler_Control *scheduler )
47{
48 return (Scheduler_simple_Context *) _Scheduler_Get_context( scheduler );
49}
50
60 RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Priority_less_equal(
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
81 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert(
82 Chain_Control *chain,
83 Thread_Control *to_insert,
84 unsigned int insert_priority
85)
86{
87 _Chain_Insert_ordered_unprotected(
88 chain,
89 &to_insert->Object.Node,
90 &insert_priority,
91 _Scheduler_simple_Priority_less_equal
92 );
93}
94
102 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Extract(
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
124 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body(
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 */
chainimpl.h
Chain Handler API.
RTEMS_INLINE_ROUTINE
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
_Chain_Extract_unprotected
RTEMS_INLINE_ROUTINE void _Chain_Extract_unprotected(Chain_Node *the_node)
Extracts this node (unprotected).
Definition: chainimpl.h:558
_Chain_Insert_ordered_unprotected
RTEMS_INLINE_ROUTINE 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
_Chain_First
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_First(const Chain_Control *the_chain)
Returns pointer to chain's first node.
Definition: chainimpl.h:260
_Scheduler_simple_Get_context
RTEMS_INLINE_ROUTINE Scheduler_simple_Context * _Scheduler_simple_Get_context(const Scheduler_Control *scheduler)
Gets context of the scheduler.
Definition: schedulersimpleimpl.h:46
_Scheduler_simple_Extract
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Extract(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Extracts the threads node.
Definition: schedulersimpleimpl.h:102
_Scheduler_simple_Priority_less_equal
RTEMS_INLINE_ROUTINE 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.
Definition: schedulersimpleimpl.h:60
_Scheduler_simple_Insert
RTEMS_INLINE_ROUTINE 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.
Definition: schedulersimpleimpl.h:81
_Scheduler_simple_Schedule_body
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body(const Scheduler_Control *scheduler, Thread_Control *the_thread, bool force_dispatch)
Scheduling decision logic.
Definition: schedulersimpleimpl.h:124
_Scheduler_Update_heir
RTEMS_INLINE_ROUTINE void _Scheduler_Update_heir(Thread_Control *new_heir, bool force_dispatch)
Updates the heir.
Definition: schedulerimpl.h:1184
_Scheduler_Get_context
RTEMS_INLINE_ROUTINE Scheduler_Context * _Scheduler_Get_context(const Scheduler_Control *scheduler)
Gets the context of the scheduler.
Definition: schedulerimpl.h:58
_Thread_Get_priority
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_priority(const Thread_Control *the_thread)
Returns the priority of the thread.
Definition: threadimpl.h:1584
schedulerimpl.h
Inlined Routines Associated with the Manipulation of the Scheduler.
schedulersimple.h
Manipulation of Threads Simple-Priority-Based Ready Queue.
Chain_Node_struct
Definition: chain.h:68
Objects_Control::Node
Chain_Node Node
Definition: objectdata.h:41
Scheduler_Node
Scheduler node for per-thread data.
Definition: schedulernode.h:79
Scheduler_simple_Context
Simple scheduler context.
Definition: schedulersimple.h:68
_Scheduler_Control
Scheduler control.
Definition: scheduler.h:269
_Thread_Control
Definition: thread.h:732
_Thread_Control::Object
Objects_Control Object
Definition: thread.h:734
Chain_Control
Definition: chain.h:86