aboutsummaryrefslogtreecommitdiffstats
path: root/src/chlists.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chlists.c')
-rw-r--r--src/chlists.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/chlists.c b/src/chlists.c
index 3b173c94d..dcb3b0412 100644
--- a/src/chlists.c
+++ b/src/chlists.c
@@ -47,19 +47,19 @@ void prio_insert(Thread *tp, ThreadsQueue *tqp) {
}
/*
- * Inserts a Thread into a FIFO queue.
+ * Inserts a Thread into a queue.
*
* @param tp the pointer to the thread to be inserted in the list
* @param tqp the pointer to the threads list header
*/
-void fifo_insert(Thread *tp, ThreadsQueue *tqp) {
+void queue_insert(Thread *tp, ThreadsQueue *tqp) {
tp->p_prev = (tp->p_next = (Thread *)tqp)->p_prev;
tp->p_prev->p_next = tqp->p_prev = tp;
}
/*
- * Removes the first-out Thread from a FIFO queue and returns it.
+ * Removes the first-out Thread from a queue and returns it.
*
* @param tqp the pointer to the threads list header
* @return the removed thread pointer
@@ -72,6 +72,19 @@ Thread *fifo_remove(ThreadsQueue *tqp) {
}
/*
+ * Removes the last-out Thread from a queue and returns it.
+ *
+ * @param tqp the pointer to the threads list header
+ * @return the removed thread pointer
+ */
+Thread *lifo_remove(ThreadsQueue *tqp) {
+ Thread *tp = tqp->p_next;
+
+ (tqp->p_next = tp->p_next)->p_prev = (Thread *)tqp;
+ return tp;
+}
+
+/*
* Removes a Thread from a FIFO list and returns it.
*
* @param tp the pointer to the thread to be removed from the list