summaryrefslogtreecommitdiff
path: root/src/kernel/task/sched.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/task/sched.cpp')
-rw-r--r--src/kernel/task/sched.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/kernel/task/sched.cpp b/src/kernel/task/sched.cpp
index d7e16d2..36f6783 100644
--- a/src/kernel/task/sched.cpp
+++ b/src/kernel/task/sched.cpp
@@ -49,3 +49,21 @@ thread *sched_dequeue() {
if (it == 0) return idle_thread;
return it;
}
+
+/* Used by task.c. Removes specified thread from any queue it is in. */
+void sched_remove(thread *t) {
+ for (int i = 0; i < PRIORITIES; i++) {
+ if (queue[i] == t) {
+ queue[i] = t->queue_next;
+ } else if (queue[i] != 0) {
+ thread *it = queue[i];
+ while (it->queue_next != 0) {
+ if (it->queue_next == t) {
+ it->queue_next = t->queue_next;
+ break;
+ }
+ it = it->queue_next;
+ }
+ }
+ }
+}