diff options
Diffstat (limited to 'cpukit/score/src/scheduleredfreleasejob.c')
-rw-r--r-- | cpukit/score/src/scheduleredfreleasejob.c | 84 |
1 files changed, 28 insertions, 56 deletions
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c index 4c74c48699..c19d9b9d24 100644 --- a/cpukit/score/src/scheduleredfreleasejob.c +++ b/cpukit/score/src/scheduleredfreleasejob.c @@ -20,75 +20,47 @@ #include <rtems/score/scheduleredfimpl.h> -static bool _Scheduler_EDF_Release_job_filter( - Thread_Control *the_thread, - Priority_Control *new_priority_p, - void *arg +void _Scheduler_EDF_Release_job( + const Scheduler_Control *scheduler, + Thread_Control *the_thread, + Priority_Node *priority_node, + uint64_t deadline, + Thread_queue_Context *queue_context ) { - Scheduler_EDF_Node *node; - Priority_Control current_priority; - Priority_Control new_priority; + (void) scheduler; - node = _Scheduler_EDF_Thread_get_node( the_thread ); + _Thread_Wait_acquire_critical( the_thread, queue_context ); - current_priority = _Thread_Get_priority( the_thread ); - new_priority = *new_priority_p; + _Priority_Node_set_priority( priority_node, deadline ); - node->current_priority = new_priority; - the_thread->real_priority = new_priority; + if ( _Priority_Node_is_active( priority_node ) ) { + _Thread_Priority_changed( + the_thread, + priority_node, + false, + queue_context + ); + } else { + _Thread_Priority_add( the_thread, priority_node, queue_context ); + } - return _Thread_Priority_less_than( current_priority, new_priority ) - || !_Thread_Owns_resources( the_thread ); + _Thread_Wait_release_critical( the_thread, queue_context ); } -Thread_Control *_Scheduler_EDF_Release_job( +void _Scheduler_EDF_Cancel_job( const Scheduler_Control *scheduler, Thread_Control *the_thread, - uint64_t deadline -) -{ - return _Thread_Apply_priority( - the_thread, - deadline, - NULL, - _Scheduler_EDF_Release_job_filter, - true - ); -} - -static bool _Scheduler_EDF_Cancel_job_filter( - Thread_Control *the_thread, - Priority_Control *new_priority_p, - void *arg + Priority_Node *priority_node, + Thread_queue_Context *queue_context ) { - Scheduler_EDF_Node *node; - Priority_Control current_priority; - Priority_Control new_priority; + (void) scheduler; - node = _Scheduler_EDF_Thread_get_node( the_thread ); + _Thread_Wait_acquire_critical( the_thread, queue_context ); - current_priority = _Thread_Get_priority( the_thread ); - new_priority = node->background_priority; + _Thread_Priority_remove( the_thread, priority_node, queue_context ); + _Priority_Node_set_inactive( priority_node ); - 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 ); -} - -Thread_Control *_Scheduler_EDF_Cancel_job( - const Scheduler_Control *scheduler, - Thread_Control *the_thread -) -{ - return _Thread_Apply_priority( - the_thread, - 0, - NULL, - _Scheduler_EDF_Cancel_job_filter, - true - ); + _Thread_Wait_release_critical( the_thread, queue_context ); } |