diff options
Diffstat (limited to 'cpukit/score/src/scheduleredfreleasejob.c')
-rw-r--r-- | cpukit/score/src/scheduleredfreleasejob.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c index b7c83a55ad..b35fb9d80e 100644 --- a/cpukit/score/src/scheduleredfreleasejob.c +++ b/cpukit/score/src/scheduleredfreleasejob.c @@ -18,29 +18,45 @@ #include "config.h" #endif -#include <rtems/score/scheduleredf.h> -#include <rtems/score/threadimpl.h> -#include <rtems/score/watchdogimpl.h> +#include <rtems/score/scheduleredfimpl.h> -void _Scheduler_EDF_Release_job( - const Scheduler_Control *scheduler, - Thread_Control *the_thread, - uint64_t deadline +static bool _Scheduler_EDF_Priority_filter( + Thread_Control *the_thread, + Priority_Control *new_priority_p, + void *arg ) { - Priority_Control new_priority; - Priority_Control unused; + Scheduler_EDF_Node *node; + Priority_Control current_priority; + Priority_Control new_priority; - (void) scheduler; + node = _Scheduler_EDF_Thread_get_node( the_thread ); - if (deadline) { - /* Initializing or shifting deadline. */ - new_priority = (uint32_t) deadline & ~SCHEDULER_EDF_PRIO_MSB; - } - else { - /* Switch back to background priority. */ - new_priority = the_thread->Start.initial_priority; + current_priority = the_thread->current_priority; + new_priority = *new_priority_p; + + if ( new_priority == 0 ) { + new_priority = node->background_priority; } - _Thread_Set_priority( the_thread, new_priority, &unused, true ); + node->current_priority = new_priority; + the_thread->real_priority = new_priority; + + return _Thread_Priority_less_than( current_priority, new_priority ) + || !_Thread_Owns_resources( the_thread ); +} + +void _Scheduler_EDF_Release_job( + const Scheduler_Control *scheduler, + Thread_Control *the_thread, + uint64_t deadline +) +{ + _Thread_Change_priority( + the_thread, + (Priority_Control) deadline, + NULL, + _Scheduler_EDF_Priority_filter, + true + ); } |