summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-17 09:02:31 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-20 15:18:48 +0100
commitf9a59164e854c3151555493231f92e570bd75a2a (patch)
tree62fdb2c457563a5d9db91e5be14f38860aad8aa7 /cpukit
parentscore: Change thread action locking (diff)
downloadrtems-f9a59164e854c3151555493231f92e570bd75a2a.tar.bz2
score: Add _Thread_Append_post_switch_action()
Update #4244.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/include/rtems/score/threadimpl.h38
1 files 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,
@@ -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.