score: Fix _Thread_Priority_change()

The POSIX sporadic server may temporarily remove the real priority of a
thread.  Check that the priority node is active before the change is
propagated.

Update #5168.
This commit is contained in:
Sebastian Huber
2024-11-26 04:30:39 +01:00
committed by Gedare Bloom
parent 5d1041d897
commit a85a2de5c7
2 changed files with 21 additions and 0 deletions

View File

@@ -96,9 +96,22 @@ extern "C" {
*/
#if defined(RTEMS_DEBUG)
/**
* @brief This define enables the thread resource count support.
*/
#define RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT
#endif
#if defined(RTEMS_POSIX_API)
/**
* @brief This define enables support for an inactive real thread priority.
*
* For example, the POSIX sporadic server may temporarily remove the real
* priority of a thread while it is in low priority mode.
*/
#define RTEMS_SCORE_THREAD_REAL_PRIORITY_MAY_BE_INACTIVE
#endif
/**
* @brief Type of the numeric argument of a thread entry function with at
* least one numeric argument.

View File

@@ -800,6 +800,14 @@ static inline void _Thread_Priority_change(
)
{
_Priority_Node_set_priority( priority_node, new_priority );
#if defined(RTEMS_SCORE_THREAD_REAL_PRIORITY_MAY_BE_INACTIVE)
if ( !_Priority_Node_is_active( priority_node ) ) {
/* The priority change is picked up once the node is added */
return;
}
#endif
_Thread_Priority_changed(
the_thread,
priority_node,