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(
338#if defined(RTEMS_SMP)
350static inline void _Priority_Set_action_type(
355#if defined(RTEMS_SMP)
369static inline void _Priority_Set_action(
375#if defined(RTEMS_SMP)
382#if defined(RTEMS_SMP)
392#
if defined(RTEMS_DEBUG)
401 next = aggregation->
Action.next;
402#if defined(RTEMS_DEBUG)
403 aggregation->
Action.next = NULL;
419static inline bool _Priority_Less(
430 return *the_left < the_right->
priority;
446static inline bool _Priority_Plain_insert(
452 return _RBTree_Insert_inline(
468static inline void _Priority_Plain_extract(
485static inline void _Priority_Plain_changed(
490 _Priority_Plain_extract( aggregation, node );
491 _Priority_Plain_insert( aggregation, node, node->priority );
494typedef void ( *Priority_Add_handler )(
500typedef void ( *Priority_Change_handler )(
507typedef void ( *Priority_Remove_handler )(
523static inline void _Priority_Change_nothing(
545static inline void _Priority_Remove_nothing(
569static inline void _Priority_Non_empty_insert(
573 Priority_Change_handler change,
579 _Assert( !_Priority_Is_empty( aggregation ) );
580 is_new_minimum = _Priority_Plain_insert( aggregation, node, node->priority );
582 if ( is_new_minimum ) {
600static inline void _Priority_Insert(
604 Priority_Add_handler add,
605 Priority_Change_handler change,
609 if ( _Priority_Is_empty( aggregation ) ) {
610 _Priority_Initialize_one( aggregation, node );
611 ( *add )( aggregation, actions, arg );
613 _Priority_Non_empty_insert( aggregation, node, actions, change, arg );
634static inline void _Priority_Extract(
638 Priority_Remove_handler remove,
639 Priority_Change_handler change,
643 _Priority_Plain_extract( aggregation, node );
645 if ( _Priority_Is_empty( aggregation ) ) {
646 ( *remove )( aggregation, actions, arg );
651 min = _Priority_Get_minimum_node( aggregation );
654 if ( node->priority < min->priority ) {
674static inline void _Priority_Extract_non_empty(
678 Priority_Change_handler change,
684 _Priority_Plain_extract( aggregation, node );
685 _Assert( !_Priority_Is_empty( aggregation ) );
687 min = _Priority_Get_minimum_node( aggregation );
689 if ( node->priority < min->priority ) {
709static inline void _Priority_Changed(
714 Priority_Change_handler change,
720 _Priority_Plain_changed( aggregation, node );
726 min = _Priority_Get_minimum_node( aggregation );
731 ( *change )( aggregation, group_order, actions, arg );
745static inline void _Priority_Replace(
754 &victim->
Node.RBTree,
755 &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