[PATCH 04/13] score: Add _Thread_Append_post_switch_action()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Feb 17 19:30:19 UTC 2021


Update #4244.
---
 cpukit/include/rtems/score/threadimpl.h | 38 ++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h
index e76f9c3972..e9d44526da 100644
--- a/cpukit/include/rtems/score/threadimpl.h
+++ b/cpukit/include/rtems/score/threadimpl.h
@@ -1236,11 +1236,16 @@ RTEMS_INLINE_ROUTINE void _Thread_Action_initialize(
 }
 
 /**
- * @brief Adds a post switch action to the thread with the given handler.
+ * @brief Adds the post switch action to the thread.
  *
- * @param[in, out] the_thread The thread.
- * @param[in,  out] action The action to add.
- * @param handler The handler for the action.
+ * The caller shall own the thread state lock.  A thread dispatch is
+ * requested.
+ *
+ * @param[in, out] the_thread is the thread of the action.
+ *
+ * @param[in, out] action is the action to add.
+ *
+ * @param handler is the handler for the action.
  */
 RTEMS_INLINE_ROUTINE void _Thread_Add_post_switch_action(
   Thread_Control        *the_thread,
@@ -1264,6 +1269,31 @@ RTEMS_INLINE_ROUTINE void _Thread_Add_post_switch_action(
   );
 }
 
+/**
+ * @brief Appends the post switch action to the thread.
+ *
+ * The caller shall own the thread state lock.  The action shall be inactive.
+ * The handler of the action shall be already set.  A thread dispatch is not
+ * requested.
+ *
+ * @param[in, out] the_thread is the thread of the action.
+ *
+ * @param[in, out] action is the action to add.
+ */
+RTEMS_INLINE_ROUTINE void _Thread_Append_post_switch_action(
+  Thread_Control *the_thread,
+  Thread_Action  *action
+)
+{
+  _Assert( _Thread_State_is_owner( the_thread ) );
+  _Assert( action->handler != NULL );
+
+  _Chain_Append_unprotected(
+    &the_thread->Post_switch_actions.Chain,
+    &action->Node
+  );
+}
+
 /**
  * @brief Checks if the thread life state is restarting.
  *
-- 
2.26.2



More information about the devel mailing list