[rtems commit] score: Add _Thread_Scheduler_remove_wait_node()

Sebastian Huber sebh at rtems.org
Wed Nov 2 09:07:44 UTC 2016


Module:    rtems
Branch:    master
Commit:    70c22d939513dd05171d99cb053dc8f71135ee25
Changeset: http://git.rtems.org/rtems/commit/?id=70c22d939513dd05171d99cb053dc8f71135ee25

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep 23 10:47:22 2016 +0200

score: Add _Thread_Scheduler_remove_wait_node()

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 0aa2c48..f259e74 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -1045,6 +1045,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 );




More information about the vc mailing list