[rtems commit] score: Add _Chain_Append_if_is_off_chain_*()

Sebastian Huber sebh at rtems.org
Wed Dec 5 17:09:37 UTC 2012


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Dec  5 16:04:02 2012 +0100

score: Add _Chain_Append_if_is_off_chain_*()

---

 cpukit/score/inline/rtems/score/chain.inl |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/cpukit/score/inline/rtems/score/chain.inl b/cpukit/score/inline/rtems/score/chain.inl
index f0714eb..ebef695 100644
--- a/cpukit/score/inline/rtems/score/chain.inl
+++ b/cpukit/score/inline/rtems/score/chain.inl
@@ -538,6 +538,25 @@ RTEMS_INLINE_ROUTINE void _Chain_Append_unprotected(
   the_node->previous = old_last;
 }
 
+/**
+ *  @brief Append a node on the end of a chain if the node is in the off chain
+ *  state (unprotected).
+ *
+ *  @note It does NOT disable interrupts to ensure the atomicity of the
+ *        append operation.
+ *
+ *  @see _Chain_Append_unprotected() and _Chain_Is_node_off_chain().
+ */
+RTEMS_INLINE_ROUTINE void _Chain_Append_if_is_off_chain_unprotected(
+  Chain_Control *the_chain,
+  Chain_Node    *the_node
+)
+{
+  if ( _Chain_Is_node_off_chain( the_node ) ) {
+    _Chain_Append_unprotected( the_chain, the_node );
+  }
+}
+
 /** @brief Prepend a Node (unprotected)
  *
  *  This routine prepends the_node onto the front of the_chain.




More information about the vc mailing list