From 65e480312c3398bd5c41d6b6b9c74e11b0de6a4f Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 26 Nov 2024 04:30:39 +0100 Subject: [PATCH] posix: Use real priority for sporadic server state This allows to other areas to use the real priority node state. Update #5164. --- cpukit/posix/src/pthreadcreate.c | 6 +++--- cpukit/posix/src/pthreadsetschedparam.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c index 6b28b371bc..c0e00bb775 100644 --- a/cpukit/posix/src/pthreadcreate.c +++ b/cpukit/posix/src/pthreadcreate.c @@ -348,7 +348,7 @@ void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog ) _Thread_queue_Context_clear_priority_updates( &queue_context ); _Thread_Wait_acquire( the_thread, &queue_context ); - if ( _Priority_Node_is_active( &api->Sporadic.Low_priority ) ) { + if ( !_Priority_Node_is_active( &the_thread->Real_priority ) ) { _Thread_Priority_add( the_thread, &the_thread->Real_priority, @@ -359,7 +359,6 @@ void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog ) &api->Sporadic.Low_priority, &queue_context ); - _Priority_Node_set_inactive( &api->Sporadic.Low_priority ); } _Watchdog_Per_CPU_remove_ticks( &api->Sporadic.Timer ); @@ -388,7 +387,7 @@ static void _POSIX_Threads_Sporadic_budget_callout( */ the_thread->CPU_budget.available = UINT32_MAX; - if ( !_Priority_Node_is_active( &api->Sporadic.Low_priority ) ) { + if ( _Priority_Node_is_active( &the_thread->Real_priority ) ) { _Thread_Priority_add( the_thread, &api->Sporadic.Low_priority, @@ -399,6 +398,7 @@ static void _POSIX_Threads_Sporadic_budget_callout( &the_thread->Real_priority, &queue_context ); + _Priority_Node_set_inactive( &the_thread->Real_priority ); } _Thread_Wait_release( the_thread, &queue_context ); diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c index 06508ef451..0eecba1f12 100644 --- a/cpukit/posix/src/pthreadsetschedparam.c +++ b/cpukit/posix/src/pthreadsetschedparam.c @@ -98,7 +98,7 @@ static int _POSIX_Set_sched_param( _Priority_Node_set_priority( &the_thread->Real_priority, core_normal_prio ); #if defined(RTEMS_POSIX_API) - if ( _Priority_Node_is_active( &api->Sporadic.Low_priority ) ) { + if ( !_Priority_Node_is_active( &the_thread->Real_priority ) ) { _Thread_Priority_add( the_thread, &the_thread->Real_priority, @@ -109,7 +109,6 @@ static int _POSIX_Set_sched_param( &api->Sporadic.Low_priority, queue_context ); - _Priority_Node_set_inactive( &api->Sporadic.Low_priority ); } else { #endif _Thread_Priority_changed(