Mercurial > hg > Game > Cerium
view TaskManager/Cell/CellBufferManager.cc @ 63:54355e641172
*** empty log message ***
author | gongo |
---|---|
date | Sun, 17 Feb 2008 10:55:22 +0900 |
parents | f50c74835a9b |
children | 519d24aa7ac8 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "CellBufferManager.h" #include "CellTaskListInfo.h" void CellBufferManager::init(void) { BufferManager::init(void); cellTaskListImpl = new CellTaskListInfo; machineTaskList = new TaskListPtr[machineNum]; for (int i = 0; i < machineNum; i++) { machineTaskList[i] = cellTaskListImpl->create(); } } #if 0 // 継承するかもしれないので保存 void CellBufferManager::append_activeTask(HTaskPtr task) { TaskQueuePtr q; q = taskQueueImpl->create(task); activeTaskQueue = taskQueueImpl->append(activeTaskQueue, q); } void CellBufferManager::append_waitTask(HTaskPtr task) { TaskQueuePtr q; q = taskQueueImpl->create(task); waitTaskQueue = taskQueueImpl->append(waitTaskQueue, q); } TaskListPtr CellBufferManager::get_available_taskList(void) { TaskListPtr list, q; list = machineTaskList[0]; while (list->next) list = list->next; if (list->length < TASK_MAX_SIZE) { return list; } else { q = cellTaskListImpl->create(); machineTaskList[0] = cellTaskListImpl->append(machineTaskList[0], q); return q; } } void CellBufferManager::clear_taskList(void) { TaskListPtr p, p1; machineTaskList[0]->length = 0; p = machineTaskList[0]->next; while (p) { p1 = p; p = p->next; cellTaskListImpl->free(p1); } } #endif