[PATCH 10/30] score: Add _Thread_Scheduler_remove_wait_node()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 31 08:51:41 UTC 2016


Update #2556.
---
 cpukit/score/include/rtems/score/threadimpl.h | 9 +++++++++
 cpukit/score/src/threadchangepriority.c       | 6 ++++--
 cpukit/score/src/threadqops.c                 | 6 ++++--
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index f3512d9..22b3094 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -1038,6 +1038,15 @@ RTEMS_INLINE_ROUTINE void _Thread_Scheduler_add_wait_node(
     &scheduler_node->Thread.Wait_node
   );
 }
+
+RTEMS_INLINE_ROUTINE void _Thread_Scheduler_remove_wait_node(
+  Thread_Control *the_thread,
+  Scheduler_Node *scheduler_node
+)
+{
+  (void) the_thread;
+  _Chain_Extract_unprotected( &scheduler_node->Thread.Wait_node );
+}
 #endif
 
 /**
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index afce28a..e107bcc 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -63,10 +63,12 @@ static void _Thread_Priority_action_remove(
 )
 {
   Scheduler_Node *scheduler_node;
+  Thread_Control *the_thread;
 
   scheduler_node = SCHEDULER_NODE_OF_WAIT_PRIORITY( priority_aggregation );
+  the_thread = arg;
 
-  _Chain_Extract_unprotected( &scheduler_node->Thread.Wait_node );
+  _Thread_Scheduler_remove_wait_node( the_thread, scheduler_node );
   _Thread_Set_scheduler_node_priority( priority_aggregation, true );
   _Priority_Set_action_type( priority_aggregation, PRIORITY_ACTION_REMOVE );
   _Priority_Actions_add( priority_actions, priority_aggregation );
@@ -139,7 +141,7 @@ static void _Thread_Priority_do_perform_actions(
           &queue_context->Priority.Actions,
           _Thread_Priority_action_remove,
           _Thread_Priority_action_change,
-          NULL
+          the_thread
         );
 #else
         _Priority_Extract_non_empty(
diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c
index 31b5875..db22efd 100644
--- a/cpukit/score/src/threadqops.c
+++ b/cpukit/score/src/threadqops.c
@@ -1222,11 +1222,13 @@ static void _Thread_queue_Priority_inherit_do_surrender_remove(
 )
 {
   Scheduler_Node *scheduler_node;
+  Thread_Control *the_thread;
 
   scheduler_node = SCHEDULER_NODE_OF_WAIT_PRIORITY( priority_aggregation );
+  the_thread = arg;
 
+  _Thread_Scheduler_remove_wait_node( the_thread, scheduler_node );
   _Priority_Actions_add( priority_actions, priority_aggregation );
-  _Chain_Extract_unprotected( &scheduler_node->Thread.Wait_node );
 }
 #endif
 
@@ -1313,7 +1315,7 @@ static void _Thread_queue_Priority_inherit_do_surrender(
       &queue_context->Priority.Actions,
       _Thread_queue_Priority_inherit_do_surrender_remove,
       _Thread_queue_Priority_inherit_do_surrender_change,
-      NULL
+      previous_owner
     );
 
     fifo_node = _Chain_Previous( fifo_node );
-- 
1.8.4.5




More information about the devel mailing list