RTEMS
|
Priority Handler. More...
Files | |
file | priority.h |
Priority Handler API. | |
file | prioritybitmapimpl.h |
Inlined Routines in the Priority Handler Bit Map Implementation. | |
file | priorityimpl.h |
Priority Handler API Implementation. | |
Classes | |
struct | Priority_Node |
The priority node to build up a priority aggregation. More... | |
struct | Priority_Aggregation |
The priority aggregation. More... | |
struct | Priority_Actions |
A list of priority actions. More... | |
Macros | |
#define | PRIORITY_MINIMUM 0 |
The highest (most important) thread priority value. | |
#define | PRIORITY_PSEUDO_ISR PRIORITY_MINIMUM |
The priority value of pseudo-ISR threads. More... | |
#define | PRIORITY_DEFAULT_MAXIMUM 255 |
The default lowest (least important) thread priority value. More... | |
Typedefs | |
typedef uint64_t | Priority_Control |
The thread priority control. More... | |
typedef struct Priority_Aggregation | Priority_Aggregation |
typedef void(* | Priority_Add_handler) (Priority_Aggregation *aggregation, Priority_Actions *actions, void *arg) |
typedef void(* | Priority_Change_handler) (Priority_Aggregation *aggregation, bool prepend_it, Priority_Actions *actions, void *arg) |
typedef void(* | Priority_Remove_handler) (Priority_Aggregation *aggregation, Priority_Actions *actions, void *arg) |
Enumerations | |
enum | Priority_Action_type { PRIORITY_ACTION_ADD, PRIORITY_ACTION_CHANGE, PRIORITY_ACTION_REMOVE, PRIORITY_ACTION_INVALID } |
The priority action type. | |
Functions | |
RTEMS_INLINE_ROUTINE unsigned int | _Bitfield_Find_first_bit (unsigned int value) |
Returns the bit number of the first bit set in the specified value. More... | |
RTEMS_INLINE_ROUTINE Priority_bit_map_Word | _Priority_Mask (unsigned int bit_number) |
Returns the priority bit mask for the specified major or minor bit number. More... | |
RTEMS_INLINE_ROUTINE unsigned int | _Priority_Bits_index (unsigned int bit_number) |
Returns the bit index position for the specified major or minor bit number. More... | |
RTEMS_INLINE_ROUTINE unsigned int | _Priority_Major (unsigned int the_priority) |
Returns the major portion of the_priority. More... | |
RTEMS_INLINE_ROUTINE unsigned int | _Priority_Minor (unsigned int the_priority) |
Returns the minor portion of the_priority. More... | |
RTEMS_INLINE_ROUTINE void | _Priority_bit_map_Initialize (Priority_bit_map_Control *bit_map) |
Initializes a bit map. More... | |
RTEMS_INLINE_ROUTINE void | _Priority_bit_map_Add (Priority_bit_map_Control *bit_map, Priority_bit_map_Information *bit_map_info) |
Adds Priority queue bit map information. More... | |
RTEMS_INLINE_ROUTINE void | _Priority_bit_map_Remove (Priority_bit_map_Control *bit_map, Priority_bit_map_Information *bit_map_info) |
Removes Priority queue bit map information. More... | |
RTEMS_INLINE_ROUTINE unsigned int | _Priority_bit_map_Get_highest (const Priority_bit_map_Control *bit_map) |
Gets highest portion of Priority queue bit map. More... | |
RTEMS_INLINE_ROUTINE bool | _Priority_bit_map_Is_empty (const Priority_bit_map_Control *bit_map) |
Checks if the Priority queue bit map is empty. More... | |
RTEMS_INLINE_ROUTINE void | _Priority_bit_map_Initialize_information (Priority_bit_map_Control *bit_map, Priority_bit_map_Information *bit_map_info, unsigned int new_priority) |
Initializes the bit map information. More... | |
static __inline__ void | _Priority_Actions_initialize_empty (Priority_Actions *actions) |
Initializes the priority actions empty. More... | |
static __inline__ void | _Priority_Actions_initialize_one (Priority_Actions *actions, Priority_Aggregation *aggregation, Priority_Node *node, Priority_Action_type type) |
Initializes the priority actions with the given information. More... | |
static __inline__ bool | _Priority_Actions_is_empty (const Priority_Actions *actions) |
Checks if the priority actions is empty. More... | |
static __inline__ bool | _Priority_Actions_is_valid (const Priority_Aggregation *aggregation) |
Checks if the priority actions is valid. More... | |
static __inline__ Priority_Aggregation * | _Priority_Actions_move (Priority_Actions *actions) |
Moves the priority actions' actions. More... | |
static __inline__ void | _Priority_Actions_add (Priority_Actions *actions, Priority_Aggregation *aggregation) |
Adds actions to the priority actions' actions. More... | |
static __inline__ void | _Priority_Node_initialize (Priority_Node *node, Priority_Control priority) |
Initializes the priority node to the given priority. More... | |
static __inline__ void | _Priority_Node_set_priority (Priority_Node *node, Priority_Control priority) |
Sets the priority of the priority node to the given priority. More... | |
static __inline__ void | _Priority_Node_set_inactive (Priority_Node *node) |
Sets the priority node inactive. More... | |
static __inline__ bool | _Priority_Node_is_active (const Priority_Node *node) |
Checks if the priority node is active. More... | |
static __inline__ void | _Priority_Initialize_empty (Priority_Aggregation *aggregation) |
Initializes the priority aggregation empty. More... | |
static __inline__ void | _Priority_Initialize_one (Priority_Aggregation *aggregation, Priority_Node *node) |
Initializes the priority aggregation with the given information. More... | |
static __inline__ bool | _Priority_Is_empty (const Priority_Aggregation *aggregation) |
Checks if the priority aggregation is empty. More... | |
static __inline__ Priority_Control | _Priority_Get_priority (const Priority_Aggregation *aggregation) |
Gets the priority aggregation's priority. More... | |
static __inline__ const Scheduler_Control * | _Priority_Get_scheduler (const Priority_Aggregation *aggregation) |
Gets the priority aggregation's scheduler. More... | |
static __inline__ Priority_Node * | _Priority_Get_minimum_node (const Priority_Aggregation *aggregation) |
Gets the minimum node of the priority aggregation. More... | |
static __inline__ void | _Priority_Set_action_node (Priority_Aggregation *aggregation, Priority_Node *node) |
Sets the action node of the priority aggregation. More... | |
static __inline__ void | _Priority_Set_action_type (Priority_Aggregation *aggregation, Priority_Action_type type) |
Sets the action type of the priority aggregation. More... | |
static __inline__ void | _Priority_Set_action (Priority_Aggregation *aggregation, Priority_Node *node, Priority_Action_type type) |
Sets the action type and action node of the priority aggregation. More... | |
static __inline__ Priority_Aggregation * | _Priority_Get_next_action (const Priority_Aggregation *aggregation) |
Gets the next action of the priority aggregation. More... | |
static __inline__ bool | _Priority_Less (const void *left, const RBTree_Node *right) |
Compares two priorities. More... | |
static __inline__ bool | _Priority_Plain_insert (Priority_Aggregation *aggregation, Priority_Node *node, Priority_Control priority) |
Inserts the node with the given priority into the priority aggregation's contributors. More... | |
static __inline__ void | _Priority_Plain_extract (Priority_Aggregation *aggregation, Priority_Node *node) |
Extracts the priority node from the aggregation. More... | |
static __inline__ void | _Priority_Plain_changed (Priority_Aggregation *aggregation, Priority_Node *node) |
Updates the priority of the node in the aggregation. More... | |
static __inline__ void | _Priority_Change_nothing (Priority_Aggregation *aggregation, bool prepend_it, Priority_Actions *actions, void *arg) |
Does nothing. More... | |
static __inline__ void | _Priority_Remove_nothing (Priority_Aggregation *aggregation, Priority_Actions *actions, void *arg) |
Does nothing. More... | |
static __inline__ void | _Priority_Non_empty_insert (Priority_Aggregation *aggregation, Priority_Node *node, Priority_Actions *actions, Priority_Change_handler change, void *arg) |
Inserts the node in a nonempty aggregation and handles change if the node is the new minimum. More... | |
static __inline__ void | _Priority_Insert (Priority_Aggregation *aggregation, Priority_Node *node, Priority_Actions *actions, Priority_Add_handler add, Priority_Change_handler change, void *arg) |
static __inline__ void | _Priority_Extract (Priority_Aggregation *aggregation, Priority_Node *node, Priority_Actions *actions, Priority_Remove_handler remove, Priority_Change_handler change, void *arg) |
Extracts the node from the aggregation. More... | |
static __inline__ void | _Priority_Extract_non_empty (Priority_Aggregation *aggregation, Priority_Node *node, Priority_Actions *actions, Priority_Change_handler change, void *arg) |
Extracts the node from the aggregation. More... | |
static __inline__ void | _Priority_Changed (Priority_Aggregation *aggregation, Priority_Node *node, bool prepend_it, Priority_Actions *actions, Priority_Change_handler change, void *arg) |
Updates the priority of the node in the aggregation. More... | |
static __inline__ void | _Priority_Replace (Priority_Aggregation *aggregation, Priority_Node *victim, Priority_Node *replacement) |
Replaces one node by another. More... | |
Variables | |
const unsigned char | _Bitfield_Leading_zeros [256] |
Priority Handler.
This handler encapsulates functionality which is used to manage thread priorities. The actual priority of a thread is an aggregation of priority nodes. The thread priority aggregation for the home scheduler instance of a thread consists of at least one priority node, which is normally the real priority of the thread. The locking protocols (e.g. priority ceiling and priority inheritance), rate-monotonic period objects and the POSIX sporadic server add, change and remove priority nodes.
#define PRIORITY_DEFAULT_MAXIMUM 255 |
The default lowest (least important) thread priority value.
This value is CPU port dependent.
Definition at line 92 of file priority.h.
#define PRIORITY_PSEUDO_ISR PRIORITY_MINIMUM |
The priority value of pseudo-ISR threads.
Examples are the MPCI and timer server threads.
Definition at line 82 of file priority.h.
typedef uint64_t Priority_Control |
The thread priority control.
Lower values represent higher priorities. So, a priority value of zero represents the highest priority thread. This value is reserved for internal threads and the priority ceiling protocol.
The format of the thread priority control depends on the context. A thread priority control may contain a user visible priority for API import/export. It may also contain a scheduler internal priority value. Values are translated via the scheduler map/unmap priority operations. The format of scheduler interal values depend on the particular scheduler implementation. It may for example encode a deadline in case of the EDF scheduler.
The thread priority control value contained in the scheduler node (Scheduler_Node::Priority::value) uses the least-significant bit to indicate if the thread should be appended or prepended to its priority group, see SCHEDULER_PRIORITY_APPEND().
Definition at line 70 of file priority.h.
RTEMS_INLINE_ROUTINE unsigned int _Bitfield_Find_first_bit | ( | unsigned int | value | ) |
Returns the bit number of the first bit set in the specified value.
The correspondence between the bit number and actual bit position is CPU architecture dependent. The search for the first bit set may run from most to least significant bit or vice-versa.
value | The value to bit scan. |
Definition at line 58 of file prioritybitmapimpl.h.
|
static |
Adds actions to the priority actions' actions.
[in,out] | actions | The priority actions to add actions to. |
[out] | aggregation | The actions to add to actions. |
Definition at line 135 of file priorityimpl.h.
|
static |
Initializes the priority actions empty.
[out] | actions | The actions to be initialized empty. |
Definition at line 44 of file priorityimpl.h.
|
static |
Initializes the priority actions with the given information.
[out] | actions | The actions to be initialized. |
aggregation | The aggregation for the actions to be initialized. | |
node | The action node for the actions to be initialized. | |
type | The action type for the actions to be initialized. |
Definition at line 59 of file priorityimpl.h.
|
static |
Checks if the priority actions is empty.
actions | The priority actions to check if it is empty. |
true | The priority actions actions is empty. |
false | The priority actions actions is empty. |
Definition at line 83 of file priorityimpl.h.
|
static |
Checks if the priority actions is valid.
aggregation | The aggregation of the priority action. |
true | The aggregation is valid. |
false | The aggregation is not valid. |
Definition at line 98 of file priorityimpl.h.
|
static |
Moves the priority actions' actions.
[in,out] | actions | The priority actions to move the actions away from. |
Definition at line 117 of file priorityimpl.h.
RTEMS_INLINE_ROUTINE void _Priority_bit_map_Add | ( | Priority_bit_map_Control * | bit_map, |
Priority_bit_map_Information * | bit_map_info | ||
) |
Adds Priority queue bit map information.
Priority Queue implemented by bit map.
[out] | bit_map | The bit map to be altered by bit_map_info. |
bit_map_info | The information with which to alter bit_map. |
Definition at line 162 of file prioritybitmapimpl.h.
RTEMS_INLINE_ROUTINE unsigned int _Priority_bit_map_Get_highest | ( | const Priority_bit_map_Control * | bit_map | ) |
Gets highest portion of Priority queue bit map.
bit_map | The bitmap to get the highest portion from. |
Definition at line 196 of file prioritybitmapimpl.h.
RTEMS_INLINE_ROUTINE void _Priority_bit_map_Initialize | ( | Priority_bit_map_Control * | bit_map | ) |
Initializes a bit map.
[out] | bit_map | The bit map to initialize. |
Definition at line 147 of file prioritybitmapimpl.h.
RTEMS_INLINE_ROUTINE void _Priority_bit_map_Initialize_information | ( | Priority_bit_map_Control * | bit_map, |
Priority_bit_map_Information * | bit_map_info, | ||
unsigned int | new_priority | ||
) |
Initializes the bit map information.
bit_map | The bit map for the initialization of the bit map information. | |
[out] | bit_map_info | The bit map information to initialize. |
new_priority | The new priority for the initialization of the bit map information. |
Definition at line 234 of file prioritybitmapimpl.h.
RTEMS_INLINE_ROUTINE bool _Priority_bit_map_Is_empty | ( | const Priority_bit_map_Control * | bit_map | ) |
Checks if the Priority queue bit map is empty.
bit_map | The bit map of which to check if it is empty. |
true | The Priority queue bit map is empty |
false | The Priority queue bit map is not empty. |
Definition at line 218 of file prioritybitmapimpl.h.
RTEMS_INLINE_ROUTINE void _Priority_bit_map_Remove | ( | Priority_bit_map_Control * | bit_map, |
Priority_bit_map_Information * | bit_map_info | ||
) |
Removes Priority queue bit map information.
Priority Queue implemented by bit map.
[out] | bit_map | The bit map to be altered by bit_map_info. |
bit_map_info | The information with which to alter bit_map. |
Definition at line 179 of file prioritybitmapimpl.h.
RTEMS_INLINE_ROUTINE unsigned int _Priority_Bits_index | ( | unsigned int | bit_number | ) |
Returns the bit index position for the specified major or minor bit number.
bit_number | The bit number for which we need an index. |
Definition at line 107 of file prioritybitmapimpl.h.
|
static |
Does nothing.
This method does nothing.
aggregation | Is ignored by the method. |
prepend_it | Is ignored by the method. |
actions | Is ignored by the method. |
arg | Is ignored by the method. |
Definition at line 488 of file priorityimpl.h.
|
static |
Updates the priority of the node in the aggregation.
This method handles the case that node was the minimal node in aggregation.
[in,out] | aggregation | The aggregation to change the node in. |
node | The node that has a new priority and will be reinserted in the aggregation. | |
prepend_it | Indicates whether change should prepend if the minimal priority is incorrectly set after the change. | |
actions | The actions for the case that the minimal priority is incorrectly set after the change. | |
change | Is called if the minimal priority is incorrectly set after the change. | |
arg | The arguments for change. |
Definition at line 673 of file priorityimpl.h.
|
static |
Extracts the node from the aggregation.
This method extracts the node from the aggregation and handles the cases that aggregation is empty after the extraction, or that node was the minimal node in aggregation by calling remove (if empty) or change (if node was the minimal node).
[in,out] | aggregation | The aggregation to extract the node from. |
node | The node to extract from aggregation. | |
actions | The actions for the cases that the aggregation is empty after the extraction, or the minimal node was extracted. | |
remove | Is called in the case that the aggregation is empty after the extraction. | |
change | Is called in the case that the minimal node was extracted. | |
arg | The arguments for remove and change. |
Definition at line 599 of file priorityimpl.h.
|
static |
Extracts the node from the aggregation.
This method extracts the node from the aggregation and handles the case that node was the minimal node in aggregation by calling change (if node was the minimal node).
[in,out] | aggregation | The aggregation to extract the node from. |
node | The node to extract from aggregation. | |
actions | The actions for the case that the minimal node was extracted. | |
change | Is called in the case that the minimal node was extracted. | |
arg | The arguments for change. |
Definition at line 637 of file priorityimpl.h.
|
static |
Gets the minimum node of the priority aggregation.
aggregation | The priority aggregation to get the minimum node from. |
Definition at line 302 of file priorityimpl.h.
|
static |
Gets the next action of the priority aggregation.
aggregation | The priority aggregation to get the next action of. |
next_action | The next action of aggregation if RTEMS_SMP is defined. |
NULL | RTEMS_SMP is not defined. |
Definition at line 363 of file priorityimpl.h.
|
static |
Gets the priority aggregation's priority.
aggregation | The priority aggregation to get the priority from. |
Definition at line 270 of file priorityimpl.h.
|
static |
Gets the priority aggregation's scheduler.
aggregation | The priority aggregation to get the scheduler from. |
Definition at line 284 of file priorityimpl.h.
|
static |
Initializes the priority aggregation empty.
[out] | aggregation | The priority aggregaton to initialize empty. |
Definition at line 211 of file priorityimpl.h.
|
static |
Initializes the priority aggregation with the given information.
[out] | aggregation | The priority aggregaton to initialize. |
node | The priority node to initialize aggregation with. |
Definition at line 232 of file priorityimpl.h.
|
static |
[in,out] | aggregation | The aggregation to insert the node in. |
node | The node to be inserted. The node's priority is used as key. | |
actions | Priority actions for the case that the aggregation was empty before the insert or the node is the new minimum. | |
add | Is called in the case that aggregation was empty before the insert. | |
change | Is called in the case that aggregation was nonempty before the insert and node is the new minimum of the aggregation. | |
arg | The arguments for change. |
Definition at line 565 of file priorityimpl.h.
|
static |
Checks if the priority aggregation is empty.
aggregation | The priority aggregation that shall be verified if it is empty. |
true | The priority aggregation is empty. |
false | The priority aggregation is not empty. |
Definition at line 256 of file priorityimpl.h.
|
static |
Compares two priorities.
left | The priority control on the left hand side of the comparison. |
right | THe RBTree_Node to get the priority for the comparison from. |
true | The priority on the left hand side of the comparison is smaller. |
false | The priority on the left hand side of the comparison is greater of equal. |
Definition at line 384 of file priorityimpl.h.
RTEMS_INLINE_ROUTINE unsigned int _Priority_Major | ( | unsigned int | the_priority | ) |
Returns the major portion of the_priority.
the_priority | The priority of which we want the major portion. |
Definition at line 125 of file prioritybitmapimpl.h.
RTEMS_INLINE_ROUTINE Priority_bit_map_Word _Priority_Mask | ( | unsigned int | bit_number | ) |
Returns the priority bit mask for the specified major or minor bit number.
bit_number | The bit number for which we need a mask. |
Definition at line 88 of file prioritybitmapimpl.h.
RTEMS_INLINE_ROUTINE unsigned int _Priority_Minor | ( | unsigned int | the_priority | ) |
Returns the minor portion of the_priority.
the_priority | The priority of which we want the minor portion. |
Definition at line 137 of file prioritybitmapimpl.h.
|
static |
Initializes the priority node to the given priority.
[out] | node | The priority node to be initialized. |
priority | The priority to initialize node to. |
Definition at line 156 of file priorityimpl.h.
|
static |
Checks if the priority node is active.
node | The priority node that shall be verified if it is active. |
true | The priority node is active. |
false | The priority node is inactive. |
Definition at line 199 of file priorityimpl.h.
|
static |
Sets the priority node inactive.
[in,out] | node | The priority node to set inactive. |
Definition at line 184 of file priorityimpl.h.
|
static |
Sets the priority of the priority node to the given priority.
[out] | node | The priority node to set the priority of. |
priority | The new priority for node. |
Definition at line 171 of file priorityimpl.h.
|
static |
Inserts the node in a nonempty aggregation and handles change if the node is the new minimum.
[in,out] | aggregation | The aggregation to insert the node into. |
node | The node to be inserted. The node's priority is used as a key. | |
actions | Parameter for change that is used if the node is the new minimum. | |
change | The priority change handler that is called in the case that the new node is the minimum of the aggregation. | |
arg | Arguments for change that is used if the node is the new minimum. |
Definition at line 534 of file priorityimpl.h.
|
static |
Updates the priority of the node in the aggregation.
It first extracts the node and inserts it again, with the new node priority as key. This method does not handle the case that node was the minimal node.
[in,out] | aggregation | The aggregation to change the node in. |
node | The node that has a new priority and will be reinserted in the aggregation. |
Definition at line 450 of file priorityimpl.h.
|
static |
Extracts the priority node from the aggregation.
This method does not handle the case that node was the minimal node.
[in,out] | aggregation | The aggregation to extract the node from. |
node | The node to be extracted. |
Definition at line 433 of file priorityimpl.h.
|
static |
Inserts the node with the given priority into the priority aggregation's contributors.
This method does not handle the case that node was the minimal node.
[in,out] | aggregation | The aggregation to insert the node in its contributors. |
[in] | node | The node to insert in the contributors. |
priority | The priority control for the inserted node. |
true | The inserted node with its priority is the minimum of the RBTree. |
false | The inserted node with its priority is not the minimum of the RBTree. |
Definition at line 411 of file priorityimpl.h.
|
static |
Does nothing.
This method does nothing.
aggregation | Is ignored by the method. |
actions | Is ignored by the method. |
arg | Is ignored by the method. |
Definition at line 510 of file priorityimpl.h.
|
static |
Replaces one node by another.
The new node has the priority of the old node.
[in,out] | aggregation | The aggregation to replace victim by replacement in. |
victim | The node that will be replaced. | |
[out] | replacement | The node that replaces victim. It obtains its priority from victim. |
Definition at line 704 of file priorityimpl.h.
|
static |
Sets the action type and action node of the priority aggregation.
[out] | aggregation | The priority aggregation to set the action type and action node of. |
node | The new action node for aggregation. | |
type | The new action type for aggregation. |
Definition at line 345 of file priorityimpl.h.
|
static |
Sets the action node of the priority aggregation.
[out] | aggregation | The priority aggregation to set the action node of. |
node | The new priority node for aggregation. |
Definition at line 315 of file priorityimpl.h.
|
static |
Sets the action type of the priority aggregation.
[out] | aggregation | The priority aggregation to set the action type of. |
type | The new action type for aggregation. |
Definition at line 329 of file priorityimpl.h.
const unsigned char _Bitfield_Leading_zeros[256] |
This table is used by the generic bitfield routines to perform a highly optimized bit scan without the use of special CPU instructions.