37#ifndef _RTEMS_SCORE_PRIORITYIMPL_H
38#define _RTEMS_SCORE_PRIORITYIMPL_H
81static inline void _Priority_Actions_initialize_empty(
96static inline void _Priority_Actions_initialize_one(
103#if defined(RTEMS_SMP)
104 aggregation->
Action.next = NULL;
109 actions->
actions = aggregation;
120static inline bool _Priority_Actions_is_empty(
124 return actions->
actions == NULL;
140 aggregation = actions->
actions;
152static inline void _Priority_Actions_add(
157#if defined(RTEMS_SMP)
165 actions->
actions = aggregation;
174static inline void _Priority_Node_initialize(
179 node->priority = priority;
180 _RBTree_Initialize_node( &node->Node.RBTree );
189static inline void _Priority_Node_set_priority(
194 node->priority = priority;
202static inline void _Priority_Node_set_inactive(
206 _RBTree_Set_off_tree( &node->Node.RBTree );
217static inline bool _Priority_Node_is_active(
221 return !_RBTree_Is_node_off_tree( &node->Node.RBTree );
229static inline void _Priority_Initialize_empty(
233#if defined(RTEMS_DEBUG)
234#if defined(RTEMS_SMP)
235 aggregation->
Action.next = NULL;
238 aggregation->
Action.
type = PRIORITY_ACTION_INVALID;
240 _RBTree_Initialize_node( &aggregation->
Node.
Node.RBTree );
250static inline void _Priority_Initialize_one(
255#if defined(RTEMS_DEBUG)
256#if defined(RTEMS_SMP)
257 aggregation->
Action.next = NULL;
260 aggregation->
Action.
type = PRIORITY_ACTION_INVALID;
262 _Priority_Node_initialize( &aggregation->
Node, node->priority );
263 _RBTree_Initialize_one( &aggregation->
Contributors, &node->Node.RBTree );
274static inline bool _Priority_Is_empty(
306#if defined(RTEMS_SMP)
307 return aggregation->scheduler;
333static inline void _Priority_Set_action_node(
348static inline void _Priority_Set_action_type(
365static inline void _Priority_Set_action(
376#if defined(RTEMS_SMP)
386#
if defined(RTEMS_DEBUG)
395 next = aggregation->
Action.next;
396#if defined(RTEMS_DEBUG)
397 aggregation->
Action.next = NULL;
413static inline bool _Priority_Less(
424 return *the_left < the_right->
priority;
440static inline bool _Priority_Plain_insert(
446 return _RBTree_Insert_inline(
462static inline void _Priority_Plain_extract(
479static inline void _Priority_Plain_changed(
484 _Priority_Plain_extract( aggregation, node );
485 _Priority_Plain_insert( aggregation, node, node->priority );
488typedef void ( *Priority_Add_handler )(
494typedef void ( *Priority_Change_handler )(
501typedef void ( *Priority_Remove_handler )(
517static inline void _Priority_Change_nothing(
539static inline void _Priority_Remove_nothing(
563static inline void _Priority_Non_empty_insert(
567 Priority_Change_handler change,
573 _Assert( !_Priority_Is_empty( aggregation ) );
574 is_new_minimum = _Priority_Plain_insert( aggregation, node, node->priority );
576 if ( is_new_minimum ) {
594static inline void _Priority_Insert(
598 Priority_Add_handler add,
599 Priority_Change_handler change,
603 if ( _Priority_Is_empty( aggregation ) ) {
604 _Priority_Initialize_one( aggregation, node );
605 ( *add )( aggregation, actions, arg );
607 _Priority_Non_empty_insert( aggregation, node, actions, change, arg );
628static inline void _Priority_Extract(
632 Priority_Remove_handler remove,
633 Priority_Change_handler change,
637 _Priority_Plain_extract( aggregation, node );
639 if ( _Priority_Is_empty( aggregation ) ) {
640 ( *remove )( aggregation, actions, arg );
645 min = _Priority_Get_minimum_node( aggregation );
648 if ( node->priority < min->priority ) {
668static inline void _Priority_Extract_non_empty(
672 Priority_Change_handler change,
678 _Priority_Plain_extract( aggregation, node );
679 _Assert( !_Priority_Is_empty( aggregation ) );
681 min = _Priority_Get_minimum_node( aggregation );
683 if ( node->priority < min->priority ) {
703static inline void _Priority_Changed(
708 Priority_Change_handler change,
714 _Priority_Plain_changed( aggregation, node );
720 min = _Priority_Get_minimum_node( aggregation );
725 ( *change )( aggregation, group_order, actions, arg );
739static inline void _Priority_Replace(
748 &victim->
Node.RBTree,
749 &replacement->
Node.RBTree
#define RTEMS_CONTAINER_OF(_m, _type, _member_name)
Gets the container of a member.
Definition: basedefs.h:306
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG and static analysis runs.
Definition: assert.h:96
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:91
Priority_Group_order
The priority group order determines if a priority node is inserted as the first or last node into its...
Definition: priorityimpl.h:62
Priority_Action_type
The priority action type.
Definition: priority.h:130
@ PRIORITY_GROUP_LAST
Priority group last option requests that the priority node is inserted as the last node into its prio...
Definition: priorityimpl.h:73
@ PRIORITY_GROUP_FIRST
Priority group first option requests that the priority node is inserted as the first node into its pr...
Definition: priorityimpl.h:67
void _RBTree_Extract(RBTree_Control *the_rbtree, RBTree_Node *the_node)
Extracts (removes) the node from the red-black tree.
Definition: rbtreeextract.c:63
void _RBTree_Replace_node(RBTree_Control *the_rbtree, RBTree_Node *victim, RBTree_Node *replacement)
Replaces a node in the red-black tree without a rebalance.
Definition: rbtreereplace.c:43
RBTree_Node * _RBTree_Minimum(const RBTree_Control *the_rbtree)
Returns the minimum node of the red-black tree.
Definition: rbtreemin.c:43
const Scheduler_Control _Scheduler_Table[]
This table contains the configured schedulers.
This header file provides interfaces of the Priority Handler which are used by the implementation and...
This header file provides interfaces of the Scheduler Handler which are used by the implementation an...
A list of priority actions.
Definition: priority.h:207
Priority_Aggregation * actions
The first action of a priority action list.
Definition: priority.h:211
The priority aggregation.
Definition: priority.h:147
Priority_Action_type type
The type of the action.
Definition: priority.h:196
struct Priority_Aggregation::@4405 Action
A priority action block to manage priority node additions, changes and removals.
Priority_Node Node
This priority node reflects the overall priority of the aggregation.
Definition: priority.h:161
RBTree_Control Contributors
A red-black tree to contain priority nodes contributing to the overall priority of this priority aggr...
Definition: priority.h:167
Priority_Node * node
The priority node of the action.
Definition: priority.h:191
The priority node to build up a priority aggregation.
Definition: priority.h:112
union Priority_Node::@4404 Node
Node component for a chain or red-black tree.
Priority_Control priority
The priority value of this node.
Definition: priority.h:124
Red-black tree node.
Definition: rbtree.h:73
Scheduler control.
Definition: scheduler.h:337