summaryrefslogtreecommitdiff
path: root/src/kernel/task/sched.cpp
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-19 17:01:56 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-19 17:01:56 +0200
commitc57a919d019606c7d83fea574159f542e431c199 (patch)
tree3363026b9a30cc3dc1d4dfc57f45b69bb3a986c4 /src/kernel/task/sched.cpp
parentd502fce7d4db492690e39c72fc029aa05a65057d (diff)
downloadTCE-c57a919d019606c7d83fea574159f542e431c199.tar.gz
TCE-c57a919d019606c7d83fea574159f542e431c199.zip
Not a bugfix. The multitasking system must be redone.
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;
+ }
+ }
+ }
+}