diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-01-31 09:27:49 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-01-31 09:27:49 +0000 |
commit | 7f8dfe2fd3e770c2e0435e9c56f5db5fd11ed6f7 (patch) | |
tree | 7335786169736fb133adfdffbc4c60f2050dac0d /os/kernel/src/chlists.c | |
parent | c73b66a3cc8d7808b9c06e031c782345d358b3e9 (diff) | |
download | ChibiOS-7f8dfe2fd3e770c2e0435e9c56f5db5fd11ed6f7.tar.gz ChibiOS-7f8dfe2fd3e770c2e0435e9c56f5db5fd11ed6f7.tar.bz2 ChibiOS-7f8dfe2fd3e770c2e0435e9c56f5db5fd11ed6f7.zip |
Implemented thread reference counters and related APIs.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1556 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/src/chlists.c')
-rw-r--r-- | os/kernel/src/chlists.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/os/kernel/src/chlists.c b/os/kernel/src/chlists.c index 4b87105bc..53f91649a 100644 --- a/os/kernel/src/chlists.c +++ b/os/kernel/src/chlists.c @@ -110,6 +110,34 @@ Thread *dequeue(Thread *tp) { tp->p_next->p_prev = tp->p_prev;
return tp;
}
+
+/**
+ * @brief Pushes a Thread on top of a stack list.
+ * @note This function is @b not an API.
+ *
+ * @param[in] tp the pointer to the thread to be inserted in the list
+ * @param[in] tlp the pointer to the threads list header
+ */
+void list_insert(Thread *tp, ThreadsList *tlp) {
+
+ tp->p_next = tlp->p_next;
+ tlp->p_next = tp;
+}
+
+/**
+ * @brief Pops a Thread from the top of a stack list and returns it.
+ * @note The list must be non-empty before calling this function.
+ * @note This function is @b not an API.
+ *
+ * @param[in] tlp the pointer to the threads list header
+ * @return The removed thread pointer.
+ */
+Thread *list_remove(ThreadsList *tlp) {
+
+ Thread *tp = tlp->p_next;
+ tlp->p_next = tp->p_next;
+ return tp;
+}
#endif /* CH_OPTIMIZE_SPEED */
/** @} */
|