summaryrefslogtreecommitdiff
path: root/Source/Kernel/TaskManager
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-11 21:58:04 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-11 21:58:04 +0200
commit277d5fcb3b378089c0f3390a0b4d1b529075958a (patch)
treedfc70f3636c3e4192785c4e052986383a3761a5c /Source/Kernel/TaskManager
parent4f1c0997990e719ac1a1cfcb80a7437009c46b7b (diff)
downloadMelon-277d5fcb3b378089c0f3390a0b4d1b529075958a.tar.gz
Melon-277d5fcb3b378089c0f3390a0b4d1b529075958a.zip
SimpleList now implements removeOnce(const T& value);
This methods searches for value in the list and removes it from the list. Only the first occurrence will be removed.
Diffstat (limited to 'Source/Kernel/TaskManager')
-rw-r--r--Source/Kernel/TaskManager/Task.ns.cpp24
1 files changed, 3 insertions, 21 deletions
diff --git a/Source/Kernel/TaskManager/Task.ns.cpp b/Source/Kernel/TaskManager/Task.ns.cpp
index 8a41340..4db05bc 100644
--- a/Source/Kernel/TaskManager/Task.ns.cpp
+++ b/Source/Kernel/TaskManager/Task.ns.cpp
@@ -7,7 +7,7 @@ extern "C" u32int idle_task(void*);
namespace Task {
-SimpleList <Process*> *processes = 0; //TODO : use a linked list instead
+SimpleList <Process*> *processes = 0;
SimpleList <Thread*> *threads = 0;
SimpleList <Thread*> *currentThread = 0;
@@ -146,16 +146,7 @@ void registerThread(Thread* t) {
void unregisterThread(Thread* t) {
if (threads == 0) return; //Tasking not yet initialized
- if (threads->v() == t) {
- threads = threads->delThis();
- return;
- }
- for (SimpleList<Thread*> *iter = threads; iter->next() != 0; iter = iter->next()) {
- if (iter->next()->v() == t) {
- iter->delNext();
- return;
- }
- }
+ threads = threads->removeOnce(t);
}
void registerProcess(Process* p) {
@@ -165,16 +156,7 @@ void registerProcess(Process* p) {
void unregisterProcess(Process* p) {
if (processes == 0) return; //Tasking not yet initialized
- if (processes->v() == p) {
- processes = processes->delThis();
- return;
- }
- for (SimpleList<Process*> *iter = processes; iter->next() != 0; iter = iter->next()) {
- if (iter->next()->v() == p) {
- iter->delNext();
- return;
- }
- }
+ processes = processes->removeOnce(p);
}
}