comparison TaskManager/Cell/CellBufferManager.cc @ 63:54355e641172

*** empty log message ***
author gongo
date Sun, 17 Feb 2008 10:55:22 +0900
parents f50c74835a9b
children 519d24aa7ac8
comparison
equal deleted inserted replaced
62:b03e4cb64302 63:54355e641172
4 #include "CellTaskListInfo.h" 4 #include "CellTaskListInfo.h"
5 5
6 void 6 void
7 CellBufferManager::init(void) 7 CellBufferManager::init(void)
8 { 8 {
9 tlistImpl = new CellTaskListInfo; 9 BufferManager::init(void);
10 tqueueImpl = new TaskQueueInfo;
11 htaskImpl = new HTaskInfo;
12 10
13 tlistImpl->init(machineNum*2); 11 cellTaskListImpl = new CellTaskListInfo;
14 tqueueImpl->init(TASK_MAX_SIZE*4); 12 machineTaskList = new TaskListPtr[machineNum];
15 htaskImpl->init(TASK_MAX_SIZE*2);
16
17 machineTaskList = new TaskListPtr[machineNum];
18 13
19 for (int i = 0; i < machineNum; i++) { 14 for (int i = 0; i < machineNum; i++) {
20 machineTaskList[i] = tlistImpl->create(); 15 machineTaskList[i] = cellTaskListImpl->create();
21 } 16 }
22 } 17 }
23 18
24 #if 0 // 継承するかもしれないので保存 19 #if 0 // 継承するかもしれないので保存
25 void 20 void
26 CellBufferManager::append_activeTask(HTaskPtr task) 21 CellBufferManager::append_activeTask(HTaskPtr task)
27 { 22 {
28 TaskQueuePtr q; 23 TaskQueuePtr q;
29 24
30 q = tqueueImpl->create(task); 25 q = taskQueueImpl->create(task);
31 activeTaskQueue = tqueueImpl->append(activeTaskQueue, q); 26 activeTaskQueue = taskQueueImpl->append(activeTaskQueue, q);
32 } 27 }
33 28
34 void 29 void
35 CellBufferManager::append_waitTask(HTaskPtr task) 30 CellBufferManager::append_waitTask(HTaskPtr task)
36 { 31 {
37 TaskQueuePtr q; 32 TaskQueuePtr q;
38 33
39 q = tqueueImpl->create(task); 34 q = taskQueueImpl->create(task);
40 waitTaskQueue = tqueueImpl->append(waitTaskQueue, q); 35 waitTaskQueue = taskQueueImpl->append(waitTaskQueue, q);
41 } 36 }
42 37
43 TaskListPtr 38 TaskListPtr
44 CellBufferManager::get_available_taskList(void) 39 CellBufferManager::get_available_taskList(void)
45 { 40 {
50 while (list->next) list = list->next; 45 while (list->next) list = list->next;
51 46
52 if (list->length < TASK_MAX_SIZE) { 47 if (list->length < TASK_MAX_SIZE) {
53 return list; 48 return list;
54 } else { 49 } else {
55 q = tlistImpl->create(); 50 q = cellTaskListImpl->create();
56 machineTaskList[0] = tlistImpl->append(machineTaskList[0], q); 51 machineTaskList[0] = cellTaskListImpl->append(machineTaskList[0], q);
57 return q; 52 return q;
58 } 53 }
59 } 54 }
60 55
61 void 56 void
67 62
68 p = machineTaskList[0]->next; 63 p = machineTaskList[0]->next;
69 while (p) { 64 while (p) {
70 p1 = p; 65 p1 = p;
71 p = p->next; 66 p = p->next;
72 tlistImpl->free(p1); 67 cellTaskListImpl->free(p1);
73 } 68 }
74 } 69 }
75 #endif 70 #endif