Mercurial > hg > Game > Cerium
changeset 2001:3e3cc12096f7 draft
dim_count and self management in multiple TaskList in a TaskArray
author | kkb |
---|---|
date | Fri, 02 May 2014 19:56:25 +0900 |
parents | ac16a57f5dd7 |
children | bbc8802bb0fd |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/kernel/ppe/HTask.cc |
diffstat | 2 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Fri May 02 19:30:48 2014 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Fri May 02 19:56:25 2014 +0900 @@ -282,7 +282,8 @@ } else { // multi dimensionだったらcount downする TaskListPtr list = (TaskListPtr)data; - if (--list->self->flag.dim_count == 0) + // only lastTaskList has self HTask + if (list->self && --list->self->flag.dim_count == 0) check_task_list_finish(schedTaskManager, list, waitTaskQueue); if (speTaskList[id]->getFirst() == list) { if (list->next) {
--- a/TaskManager/kernel/ppe/HTask.cc Fri May 02 19:30:48 2014 +0900 +++ b/TaskManager/kernel/ppe/HTask.cc Fri May 02 19:56:25 2014 +0900 @@ -21,7 +21,6 @@ { this->flag.dim_count = 1; TaskList *tl = (TaskList*)rbuf; - tl->self = this; tl->set_last(last); mimpl->spawn_task(this); } @@ -29,13 +28,14 @@ void HTask::iterate(long x) { this->flag.dim_count = 1; - TaskList *tl = (TaskList*)rbuf; - tl->self = this; - tl->set_last(last); - tl->dim=1; - tl->x=x; - tl->y=1; - tl->z=1; + TaskList *tl = (TaskList*)rbuf; + for (;tl;tl=tl->next) { + tl->set_last(last); + tl->dim=1; + tl->x=x; + tl->y=1; + tl->z=1; + } mimpl->spawn_task(this); } @@ -123,7 +123,7 @@ { r_size = 0; TaskListPtr tl = mimpl->createTaskList(); - tl->self = 0; + tl->self = this; this->flag.dim_count = 1; rbuf = (memaddr)tl; bzero(tl->tasks,sizeof(Task)*TASK_MAX_SIZE); @@ -167,6 +167,7 @@ last = task->next(); return task; } + // lastTask can't exceed TaskList int task_size = Task::calc_size(param_count, inData_count, outData_count); Task *next=get_nextTaskArea(t,tl,task_size); next->init(id, param_count, inData_count, outData_count); @@ -182,10 +183,10 @@ TaskListPtr nextTaskList = mimpl->createTaskList(); nextTaskList->prev = tl; tl->next = nextTaskList; - tl = nextTaskList; - next = tl->tasks; + next = nextTaskList->tasks; + nextTaskList->self = tl->self; tl->self = 0; - rbuf = (memaddr)tl; + rbuf = (memaddr)nextTaskList; } return next;