Mercurial > hg > Game > Cerium
changeset 497:3429986b8a28 draft
no wakeup loop
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 10 Oct 2009 21:05:55 +0900 |
parents | 67fb962f58fa |
children | bce667ff20b9 |
files | TaskManager/kernel/ppe/HTaskInfo.cc TaskManager/kernel/ppe/Task.h TaskManager/kernel/ppe/TaskManagerImpl.cc TaskManager/kernel/ppe/TaskQueueInfo.cc TaskManager/kernel/schedule/SchedTask.cc |
diffstat | 5 files changed, 23 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/HTaskInfo.cc Sat Oct 10 20:32:55 2009 +0900 +++ b/TaskManager/kernel/ppe/HTaskInfo.cc Sat Oct 10 21:05:55 2009 +0900 @@ -73,7 +73,7 @@ q->command = cmd; q->inData->clear(); q->outData->clear(); - q->self = (unsigned int)q; + q->self = (TaskQueuePtr) q; q->param_size = 0; q->post_func = NULL;
--- a/TaskManager/kernel/ppe/Task.h Sat Oct 10 20:32:55 2009 +0900 +++ b/TaskManager/kernel/ppe/Task.h Sat Oct 10 21:05:55 2009 +0900 @@ -7,6 +7,8 @@ #define MAX_PARAMS 8 +class TaskQueue; + class Task { public: // variables @@ -15,7 +17,7 @@ int command; // 4 byte ListDataPtr inData; // 4 byte 64bit であるべき ListDataPtr outData; // 4 byte 64bit であるべき - uint32 self; // 4 byte + TaskQueue *self; // 4 byte int param_size; // 4 byte int param[MAX_PARAMS]; // 4*MAX_PARAMS byte
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Sat Oct 10 20:32:55 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Sat Oct 10 21:05:55 2009 +0900 @@ -120,21 +120,26 @@ * @param [task] 終了したタスク */ void -TaskManagerImpl::check_task_finish(HTaskPtr task) +TaskManagerImpl::check_task_finish(HTaskPtr me) { - while(TaskQueue *p = task->wait_me->poll()) { - HTaskPtr htask = (HTaskPtr)p->task; - TaskQueueInfo *wait_i = htask->wait_i; + while(TaskQueue *p = me->wait_me->poll()) { + HTaskPtr you = (HTaskPtr)p->task; + TaskQueueInfo *wait_i = you->wait_i; // 相手の wait queue から自分(を指しているTaskQueue)を削除 wait_i->remove(p->waiter); // queue を free する wait_i->free_(p->waiter); + if (wait_i->empty()) { + waitTaskQueue->remove(you->self); + append_activeTask(you->self); + } + wait_i->free_(p); } - task->post_func(task->post_arg); - htaskImpl->free(task); + me->post_func(me->post_arg); + htaskImpl->free(me); } @@ -151,18 +156,7 @@ void TaskManagerImpl::wakeup_waitTask(void) { - - for(TaskQueuePtr p = waitTaskQueue->getFirst(); p;) { - HTaskPtr task = (HTaskPtr)p->task; - if (task->wait_i->empty()) { - TaskQueuePtr next = waitTaskQueue->getNext(p); - waitTaskQueue->remove(p); - append_activeTask(p); - p = next; - } else { - p = waitTaskQueue->getNext(p); - } - } + // done in check_task_finish } /* end */
--- a/TaskManager/kernel/ppe/TaskQueueInfo.cc Sat Oct 10 20:32:55 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskQueueInfo.cc Sat Oct 10 21:05:55 2009 +0900 @@ -53,6 +53,7 @@ q->next = q->prev = NULL; q->waiter = NULL; q->task = task; + task->self = q; return q; }
--- a/TaskManager/kernel/schedule/SchedTask.cc Sat Oct 10 20:32:55 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Sat Oct 10 21:05:55 2009 +0900 @@ -136,7 +136,7 @@ #endif taskGroup = new TaskGroup; - taskGroup->command = task->self; + taskGroup->command = (int)task->self; } /** @@ -202,7 +202,7 @@ free(readbuf); if (taskGroup->status() != 0) { - task->self = taskGroup->command; + task->self = (TaskQueuePtr)taskGroup->command; delete taskGroup; taskGroup = NULL; } @@ -231,7 +231,7 @@ free(writebuf); #endif - if (task->self == MY_SPE_NOP) return; + if ((int)task->self == MY_SPE_NOP) return; (this->*ex_write)(); } @@ -285,7 +285,7 @@ * or 生成されたが、そのタスクの終了を待つ必要は無い */ if (renew_flag == 0) { - scheduler->mail_write(task->self); + scheduler->mail_write((int)task->self); } } @@ -514,7 +514,7 @@ p->inData->clear(); p->outData->clear(); - p->self = MY_SPE_NOP; + p->self = (TaskQueuePtr)MY_SPE_NOP; p->param_size = 0; return p; @@ -527,7 +527,7 @@ void SchedTask::wait_task(TaskPtr waitTask) { - waitTask->self = (uint32)taskGroup; + waitTask->self = (TaskQueuePtr)taskGroup; scheduler->add_groupTask(taskGroup, waitTask);