[rtems commit] score: Add _Thread_Scheduler_add_wait_node()

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


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

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

score: Add _Thread_Scheduler_add_wait_node()

Update #2556.

---

 cpukit/score/include/rtems/score/threadimpl.h | 13 +++++++++++++
 cpukit/score/src/threadchangepriority.c       |  5 +----
 cpukit/score/src/threadqops.c                 |  5 +----
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 51d9d47..0aa2c48 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -1034,6 +1034,19 @@ RTEMS_INLINE_ROUTINE Scheduler_Node *_Thread_Scheduler_get_node_by_index(
 #endif
 }
 
+#if defined(RTEMS_SMP)
+RTEMS_INLINE_ROUTINE void _Thread_Scheduler_add_wait_node(
+  Thread_Control *the_thread,
+  Scheduler_Node *scheduler_node
+)
+{
+  _Chain_Append_unprotected(
+    &the_thread->Scheduler.Wait_nodes,
+    &scheduler_node->Thread.Wait_node
+  );
+}
+#endif
+
 /**
  * @brief Returns the priority of the thread.
  *
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index 41b6382..afce28a 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -50,10 +50,7 @@ static void _Thread_Priority_action_add(
   scheduler_node = SCHEDULER_NODE_OF_WAIT_PRIORITY( priority_aggregation );
   the_thread = arg;
 
-  _Chain_Append_unprotected(
-    &the_thread->Scheduler.Wait_nodes,
-    &scheduler_node->Thread.Wait_node
-  );
+  _Thread_Scheduler_add_wait_node( the_thread, scheduler_node );
   _Thread_Set_scheduler_node_priority( priority_aggregation, false );
   _Priority_Set_action_type( priority_aggregation, PRIORITY_ACTION_ADD );
   _Priority_Actions_add( priority_actions, priority_aggregation );
diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c
index c0e0f67..31b5875 100644
--- a/cpukit/score/src/threadqops.c
+++ b/cpukit/score/src/threadqops.c
@@ -1207,10 +1207,7 @@ static void _Thread_queue_Priority_inherit_do_surrender_add(
   scheduler_node = SCHEDULER_NODE_OF_WAIT_PRIORITY( priority_aggregation );
   the_thread = arg;
 
-  _Chain_Append_unprotected(
-    &the_thread->Scheduler.Wait_nodes,
-    &scheduler_node->Thread.Wait_node
-  );
+  _Thread_Scheduler_add_wait_node( the_thread, scheduler_node );
   _Scheduler_Node_set_priority(
     scheduler_node,
     _Priority_Get_priority( priority_aggregation ),



More information about the vc mailing list