Mercurial > hg > Game > Cerium
changeset 495:f2816cf264ae draft
fix wakeup_task
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 10 Oct 2009 19:16:09 +0900 |
parents | f1470e379c31 |
children | 67fb962f58fa |
files | TaskManager/kernel/ppe/TaskManagerImpl.cc TaskManager/kernel/ppe/TaskQueueInfo.cc TaskManager/kernel/ppe/TaskQueueInfo.h |
diffstat | 3 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Sat Oct 10 17:30:29 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Sat Oct 10 19:16:09 2009 +0900 @@ -151,11 +151,17 @@ void TaskManagerImpl::wakeup_waitTask(void) { - while (TaskQueuePtr p = waitTaskQueue->poll()) { + + for(TaskQueuePtr p = waitTaskQueue->getFirst(); p;) { HTaskPtr task = (HTaskPtr)p->task; if (task->wait_i->empty()) { + TaskQueuePtr next = waitTaskQueue->getNext(p); + waitTaskQueue->remove(p); activeTaskQueue->addLast(p); - } + p = next; + } else { + p = waitTaskQueue->getNext(p); + } } }
--- a/TaskManager/kernel/ppe/TaskQueueInfo.cc Sat Oct 10 17:30:29 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskQueueInfo.cc Sat Oct 10 19:16:09 2009 +0900 @@ -182,5 +182,13 @@ return next == this; } +TaskQueue* +TaskQueueInfo::getNext(TaskQueue* q) +{ + if (q->next==this) return NULL; + return q->next; +} + + /* end */
--- a/TaskManager/kernel/ppe/TaskQueueInfo.h Sat Oct 10 17:30:29 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskQueueInfo.h Sat Oct 10 19:16:09 2009 +0900 @@ -29,6 +29,9 @@ int empty(); void TaskQueueInfo::freePool() ; + // Iterator + TaskQueue* getNext(TaskQueue* q) ; + int hasNext(TaskQueue* q); private: /* variables */