Mercurial > hg > Game > Cerium
diff TaskManager/kernel/ppe/BufferManager.cc @ 63:54355e641172
*** empty log message ***
author | gongo |
---|---|
date | Sun, 17 Feb 2008 10:55:22 +0900 |
parents | 90523ccc4dff |
children | 178459e03f5c |
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/BufferManager.cc Sat Feb 16 21:42:17 2008 +0900 +++ b/TaskManager/kernel/ppe/BufferManager.cc Sun Feb 17 10:55:22 2008 +0900 @@ -10,25 +10,21 @@ void BufferManager::init(void) { - tlistImpl = new TaskListInfo; - tqueueImpl = new TaskQueueInfo; - htaskImpl = new HTaskInfo; + taskListImpl = new TaskListInfo; + taskQueueImpl = new TaskQueueInfo; + htaskImpl = new HTaskInfo; - tlistImpl->init(machineNum*2); - tqueueImpl->init(TASK_MAX_SIZE*4); + taskListImpl->init(machineNum*2); + taskQueueImpl->init(TASK_MAX_SIZE*4); htaskImpl->init(TASK_MAX_SIZE*2); - - machineTaskList = new TaskListPtr[machineNum]; - for (int i = 0; i < machineNum; i++) { - machineTaskList[i] = tlistImpl->create(); - } + mainTaskList = taskListImpl->create(); } TaskQueuePtr BufferManager::create_taskQueue(HTaskPtr task) { - return tqueueImpl->create(task); + return taskQueueImpl->create(task); } HTaskPtr @@ -40,7 +36,7 @@ void BufferManager::free_taskQueue(TaskQueuePtr q) { - tqueueImpl->free(q); + taskQueueImpl->free(q); } void @@ -54,25 +50,33 @@ { TaskQueuePtr q; - q = tqueueImpl->create(task); - activeTaskQueue = tqueueImpl->append(activeTaskQueue, q); + q = taskQueueImpl->create(task); + activeTaskQueue = taskQueueImpl->append(activeTaskQueue, q); } void BufferManager::finish(void) { - delete tlistImpl; - delete tqueueImpl; + delete taskListImpl; + delete taskQueueImpl; delete htaskImpl; } +/** + * waitTaskList って別で持つ必要あるのかな。 + * ここでいう wait ってのは依存のことで、 + * 依存される? task はすでにこの task を持っているわけだから。 + * わざわざ waitTaskList を持つ必要は無い。 + * けど、OS とかだと依存とかじゃない wait もあるんだよな。 + * 消す必要は無いか。 + */ void BufferManager::append_waitTask(HTaskPtr task) { - TaskQueuePtr q; + //TaskQueuePtr q; - q = tqueueImpl->create(task); - waitTaskQueue = tqueueImpl->append(waitTaskQueue, q); + //q = taskQueueImpl->create(task); + //waitTaskQueue = taskQueueImpl->append(waitTaskQueue, q); } void @@ -99,7 +103,7 @@ d = p; p = p->next; append_activeTask(task); - waitTaskQueue = remove_taskQueue(waitTaskQueue, d); + //waitTaskQueue = remove_taskQueue(waitTaskQueue, d); } else { p = p->next; } @@ -116,7 +120,7 @@ if (p->task == task) { list = list->next; - tqueueImpl->free(p); + taskQueueImpl->free(p); } else { p1 = p->next; while (p1 && p1->task && p1->task != task) { @@ -125,7 +129,7 @@ } if (p1) { p->next = p1->next; - tqueueImpl->free(p1); + taskQueueImpl->free(p1); } } @@ -142,7 +146,7 @@ if (p == q) { list = list->next; - tqueueImpl->free(p); + taskQueueImpl->free(p); } else { p1 = p->next; while (p1 && p1 != q) { @@ -151,7 +155,7 @@ } if (p1) { p->next = p1->next; - tqueueImpl->free(p1); + taskQueueImpl->free(p1); } } @@ -163,15 +167,15 @@ { TaskListPtr list, q; - list = machineTaskList[0]; + list = mainTaskList; while (list->next) list = list->next; if (list->length < TASK_MAX_SIZE) { return list; } else { - q = tlistImpl->create(); - machineTaskList[0] = tlistImpl->append(machineTaskList[0], q); + q = taskListImpl->create(); + mainTaskList = taskListImpl->append(mainTaskList, q); return q; } } @@ -181,12 +185,12 @@ { TaskListPtr p, p1; - machineTaskList[0]->length = 0; + mainTaskList->length = 0; - p = machineTaskList[0]->next; + p = mainTaskList->next; while (p) { p1 = p; p = p->next; - tlistImpl->free(p1); + taskListImpl->free(p1); } }