Mercurial > hg > Members > kono > Cerium
comparison TaskManager/kernel/schedule/SchedTask.cc @ 708:56487849ea2d
cleean up SchedTasks.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Dec 2009 10:49:30 +0900 |
parents | e4d2b823903c |
children | f725c6455d19 |
comparison
equal
deleted
inserted
replaced
707:cfca6511aac5 | 708:56487849ea2d |
---|---|
16 #define TaskPtr SimpleTaskPtr | 16 #define TaskPtr SimpleTaskPtr |
17 #endif | 17 #endif |
18 | 18 |
19 extern TaskObject task_list[MAX_TASK_OBJECT]; | 19 extern TaskObject task_list[MAX_TASK_OBJECT]; |
20 | 20 |
21 /** | |
22 Task Object を作る | |
23 */ | |
24 | |
25 | |
26 SchedTask * | |
27 createSchedTask(Scheduler *scheduler, TaskPtr task) | |
28 { | |
29 return new SchedTask(); | |
30 } | |
31 | 21 |
32 #if 0 | 22 #if 0 |
33 /** | 23 /** |
34 code load を始める。既に get_segment hash に入っていれば何もしない。 | 24 code load を始める。既に get_segment hash に入っていれば何もしない。 |
35 */ | 25 */ |
68 { | 58 { |
69 } | 59 } |
70 | 60 |
71 | 61 |
72 void | 62 void |
73 SchedTask::init(TaskListPtr _list, TaskPtr _task, int index, | 63 SchedTask::init(TaskListPtr _list, TaskPtr _task, int index, Scheduler* sc) |
74 // ListDataPtr rbuf, ListDataPtr wbuf, | |
75 Scheduler* sc) | |
76 { | 64 { |
77 list = _list; | 65 list = _list; |
78 task = _task; | 66 task = _task; |
79 #ifndef SIMPLE_TASK | 67 #ifndef SIMPLE_TASK |
80 inListData = &_task->inData; | 68 inListData = &_task->inData; |
167 | 155 |
168 if (cur_index < list->length) { | 156 if (cur_index < list->length) { |
169 // Task List が残っているので、次を準備 | 157 // Task List が残っているので、次を準備 |
170 | 158 |
171 TaskPtr nextTask = &list->tasks[cur_index++]; | 159 TaskPtr nextTask = &list->tasks[cur_index++]; |
172 SchedTaskBase *nextSched = createSchedTask(scheduler, nextTask); | 160 SchedTask *nextSched = new SchedTask(); |
173 ((SchedTask*)nextSched)->init(list, nextTask, cur_index, scheduler); | 161 nextSched->init(list, nextTask, cur_index, scheduler); |
174 #ifdef SIMPLE_TASK | 162 #ifdef SIMPLE_TASK |
175 if (nextTask->command==TaskArray1) { | 163 if (nextTask->command==TaskArray1) { |
176 // compatibility | 164 // compatibility |
177 return new SchedTaskArray(scheduler, nextSched); | 165 return new SchedTaskArray(scheduler, nextSched); |
178 } | 166 } |
179 if (nextTask->command==TaskArray) { | 167 if (nextTask->command==TaskArray) { |
180 // Start Task Array | 168 // Start Task Array |
181 return (SchedTaskBase*)(new SchedTaskArrayLoad(scheduler, nextSched)); | 169 return new SchedTaskArrayLoad(scheduler, nextSched); |
182 } | 170 } |
183 #endif | 171 #endif |
184 return nextSched; | 172 return nextSched; |
185 } else { | 173 } else { |
186 memaddr nextList = (memaddr)list->next; | 174 memaddr nextList = (memaddr)list->next; |
187 if (nextList == 0) { | 175 if (nextList == 0) { |
188 // もう何もする必要がない | 176 // もう何もする必要がない |
189 return new SchedNop2Ready(scheduler); | 177 return new SchedNop2Ready(scheduler); |
190 } else { | 178 } else { |
191 // 新しいリストに取り掛かる | 179 // 新しいリストに取り掛かる |
192 return createSchedTaskList(nextList, scheduler, 0); | 180 return new SchedTaskList(nextList, scheduler); |
193 } | 181 } |
194 } | 182 } |
195 } | 183 } |
196 | 184 |
197 | 185 |
198 int | 186 int |
199 SchedTask::get_cpuid() | 187 SchedTask::get_cpuid() |
200 { | 188 { |
201 return scheduler->id; | 189 return scheduler->id; |
190 } | |
191 | |
192 void SchedTask::free_(void *p) { | |
193 scheduler->free_(p); | |
202 } | 194 } |
203 | 195 |
204 #ifndef SIMPLE_TASK | 196 #ifndef SIMPLE_TASK |
205 /** | 197 /** |
206 * task->add_inData で与えられた順番に対応する index (0〜n-1) で、 | 198 * task->add_inData で与えられた順番に対応する index (0〜n-1) で、 |