57
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3 #include "CellBufferManager.h"
|
|
4 #include "CellTaskListInfo.h"
|
|
5
|
|
6 void
|
60
|
7 CellBufferManager::init(void)
|
57
|
8 {
|
63
|
9 BufferManager::init(void);
|
57
|
10
|
63
|
11 cellTaskListImpl = new CellTaskListInfo;
|
|
12 machineTaskList = new TaskListPtr[machineNum];
|
57
|
13
|
|
14 for (int i = 0; i < machineNum; i++) {
|
63
|
15 machineTaskList[i] = cellTaskListImpl->create();
|
57
|
16 }
|
|
17 }
|
|
18
|
|
19 #if 0 // 継承するかもしれないので保存
|
|
20 void
|
60
|
21 CellBufferManager::append_activeTask(HTaskPtr task)
|
57
|
22 {
|
|
23 TaskQueuePtr q;
|
|
24
|
63
|
25 q = taskQueueImpl->create(task);
|
|
26 activeTaskQueue = taskQueueImpl->append(activeTaskQueue, q);
|
57
|
27 }
|
|
28
|
|
29 void
|
60
|
30 CellBufferManager::append_waitTask(HTaskPtr task)
|
57
|
31 {
|
|
32 TaskQueuePtr q;
|
|
33
|
63
|
34 q = taskQueueImpl->create(task);
|
|
35 waitTaskQueue = taskQueueImpl->append(waitTaskQueue, q);
|
57
|
36 }
|
|
37
|
|
38 TaskListPtr
|
60
|
39 CellBufferManager::get_available_taskList(void)
|
57
|
40 {
|
|
41 TaskListPtr list, q;
|
|
42
|
|
43 list = machineTaskList[0];
|
|
44
|
|
45 while (list->next) list = list->next;
|
|
46
|
|
47 if (list->length < TASK_MAX_SIZE) {
|
|
48 return list;
|
|
49 } else {
|
63
|
50 q = cellTaskListImpl->create();
|
|
51 machineTaskList[0] = cellTaskListImpl->append(machineTaskList[0], q);
|
57
|
52 return q;
|
|
53 }
|
|
54 }
|
|
55
|
|
56 void
|
60
|
57 CellBufferManager::clear_taskList(void)
|
57
|
58 {
|
|
59 TaskListPtr p, p1;
|
|
60
|
|
61 machineTaskList[0]->length = 0;
|
|
62
|
|
63 p = machineTaskList[0]->next;
|
|
64 while (p) {
|
|
65 p1 = p;
|
|
66 p = p->next;
|
63
|
67 cellTaskListImpl->free(p1);
|
57
|
68 }
|
|
69 }
|
|
70 #endif
|