[rtems commit] score: Add _Thread_Append_post_switch_action()
Sebastian Huber
sebh at rtems.org
Sat Feb 20 14:25:22 UTC 2021
Module: rtems
Branch: master
Commit: f9a59164e854c3151555493231f92e570bd75a2a
Changeset: http://git.rtems.org/rtems/commit/?id=f9a59164e854c3151555493231f92e570bd75a2a
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Feb 17 09:02:31 2021 +0100
score: Add _Thread_Append_post_switch_action()
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 e76f9c3..e9d4452 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,
@@ -1265,6 +1270,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.
*
* @param life_state The thread life state for the verification.
More information about the vc
mailing list