Mercurial > hg > Members > kono > Cerium
comparison TaskManager/kernel/ppe/TaskManagerImpl.cc @ 475:e083c4ff91c1
BufferManager removed.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 04 Oct 2009 11:29:50 +0900 (2009-10-04) |
parents | eab18aa0c7f6 |
children | 5bda98b0b56d |
comparison
equal
deleted
inserted
replaced
474:077845279741 | 475:e083c4ff91c1 |
---|---|
40 HTaskPtr | 40 HTaskPtr |
41 TaskManagerImpl::create_task(int cmd) | 41 TaskManagerImpl::create_task(int cmd) |
42 { | 42 { |
43 HTaskPtr new_task; | 43 HTaskPtr new_task; |
44 | 44 |
45 new_task = bufferManager->create_task(cmd); | 45 new_task = htaskImpl->create(cmd); |
46 new_task->post_func = noaction; | 46 new_task->post_func = noaction; |
47 new_task->mimpl = this; | 47 new_task->mimpl = this; |
48 | 48 |
49 return new_task; | 49 return new_task; |
50 } | 50 } |
57 void | 57 void |
58 TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave) | 58 TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave) |
59 { | 59 { |
60 TaskQueuePtr m, s; | 60 TaskQueuePtr m, s; |
61 | 61 |
62 m = bufferManager->create_taskQueue(master); | 62 m = taskQueueImpl->create(master); |
63 s = bufferManager->create_taskQueue(slave); | 63 s = taskQueueImpl->create(slave); |
64 | 64 |
65 master->wait_me = TaskQueue::append(master->wait_me, s); | 65 master->wait_me = TaskQueue::append(master->wait_me, s); |
66 slave->wait_i = TaskQueue::append(slave->wait_i, m); | 66 slave->wait_i = TaskQueue::append(slave->wait_i, m); |
67 } | 67 } |
68 | 68 |
91 void | 91 void |
92 TaskManagerImpl::append_activeTask(HTaskPtr task) | 92 TaskManagerImpl::append_activeTask(HTaskPtr task) |
93 { | 93 { |
94 TaskQueuePtr q; | 94 TaskQueuePtr q; |
95 | 95 |
96 q = bufferManager->create_taskQueue(task); | 96 q = taskQueueImpl->create(task); |
97 activeTaskQueue = TaskQueue::append(activeTaskQueue, q); | 97 activeTaskQueue = TaskQueue::append(activeTaskQueue, q); |
98 } | 98 } |
99 | 99 |
100 /** | 100 /** |
101 * タスクが実行する CPU を選択する | 101 * タスクが実行する CPU を選択する |
119 void | 119 void |
120 TaskManagerImpl::check_task_finish(HTaskPtr task) | 120 TaskManagerImpl::check_task_finish(HTaskPtr task) |
121 { | 121 { |
122 notify_wait_taskQueue(task, task->wait_me); | 122 notify_wait_taskQueue(task, task->wait_me); |
123 task->post_func(task->post_arg); | 123 task->post_func(task->post_arg); |
124 bufferManager->free_task(task); | 124 htaskImpl->free(task); |
125 } | 125 } |
126 | 126 |
127 /** | 127 /** |
128 * 終了したタスク [depend] を待っている TaskList に | 128 * 終了したタスク [depend] を待っている TaskList に |
129 * 終わった事を知らせる(削除する | 129 * 終わった事を知らせる(削除する |
148 void | 148 void |
149 TaskManagerImpl::append_waitTask(HTaskPtr task) | 149 TaskManagerImpl::append_waitTask(HTaskPtr task) |
150 { | 150 { |
151 TaskQueuePtr q; | 151 TaskQueuePtr q; |
152 | 152 |
153 q = bufferManager->create_taskQueue(task); | 153 q = taskQueueImpl->create(task); |
154 waitTaskQueue = TaskQueue::append(waitTaskQueue, q); | 154 waitTaskQueue = TaskQueue::append(waitTaskQueue, q); |
155 } | 155 } |
156 | 156 |
157 /** | 157 /** |
158 * waitQueue の中で依存関係を満たしたタスクは | 158 * waitQueue の中で依存関係を満たしたタスクは |
181 TaskQueuePtr p = list; | 181 TaskQueuePtr p = list; |
182 TaskQueuePtr p1; | 182 TaskQueuePtr p1; |
183 | 183 |
184 while (p != NULL) { | 184 while (p != NULL) { |
185 p1 = p->next; | 185 p1 = p->next; |
186 bufferManager->free_taskQueue(p); | 186 taskQueueImpl->free(p); |
187 p = p1; | 187 p = p1; |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 /** | 191 /** |
201 | 201 |
202 if (p == NULL) return p; | 202 if (p == NULL) return p; |
203 | 203 |
204 if (p->task == task) { | 204 if (p->task == task) { |
205 list = list->next; | 205 list = list->next; |
206 bufferManager->free_taskQueue(p); | 206 taskQueueImpl->free(p); |
207 } else { | 207 } else { |
208 p1 = p->next; | 208 p1 = p->next; |
209 while (p1 && p1->task && p1->task != task) { | 209 while (p1 && p1->task && p1->task != task) { |
210 p1 = p1->next; | 210 p1 = p1->next; |
211 p = p->next; | 211 p = p->next; |
212 } | 212 } |
213 if (p1) { | 213 if (p1) { |
214 p->next = p1->next; | 214 p->next = p1->next; |
215 bufferManager->free_taskQueue(p1); | 215 taskQueueImpl->free(p1); |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 return list; | 219 return list; |
220 } | 220 } |
227 | 227 |
228 if (!p) return p; | 228 if (!p) return p; |
229 | 229 |
230 if (p == q) { | 230 if (p == q) { |
231 list = list->next; | 231 list = list->next; |
232 bufferManager->free_taskQueue(p); | 232 taskQueueImpl->free(p); |
233 } else { | 233 } else { |
234 p1 = p->next; | 234 p1 = p->next; |
235 while (p1 && p1 != q) { | 235 while (p1 && p1 != q) { |
236 p1 = p1->next; | 236 p1 = p1->next; |
237 p = p->next; | 237 p = p->next; |
238 } | 238 } |
239 if (p1) { | 239 if (p1) { |
240 p->next = p1->next; | 240 p->next = p1->next; |
241 bufferManager->free_taskQueue(p1); | 241 taskQueueImpl->free(p1); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 return list; | 245 return list; |
246 } | 246 } |