Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/ppe/HTask.cc @ 687:25afcd4ae380 draft
test code for TaskArray
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 06 Dec 2009 18:13:46 +0900 |
parents | fbcbcc5ad3b5 |
children | 77c89477daa8 |
rev | line source |
---|---|
109 | 1 #include "HTask.h" |
2 #include "ListData.h" | |
3 #include "TaskManagerImpl.h" | |
4 | |
5 | |
293 | 6 /*! |
297 | 7 manager->set_task_depend(task1, task2); // task2 は task1 の終了を待つ |
293 | 8 |
297 | 9 ってやるより |
293 | 10 |
11 task2->set_depend(task1); | |
12 | |
297 | 13 ってやったほうがわかりやすいよねー的な話し合いで |
14 下のようなAPIを作りました | |
293 | 15 */ |
16 | |
109 | 17 void |
18 HTask::spawn(void) | |
19 { | |
20 mimpl->spawn_task(this); | |
21 } | |
22 | |
293 | 23 /*! |
297 | 24 @brief この Task が待ち合わせする Task を指定する |
25 @param[in] master この Task が終了待ち合わせをする相手の Task | |
293 | 26 |
297 | 27 繰り返し使用する事で複数の Task を待ち合わせする事ができる。 |
293 | 28 |
297 | 29 wait_for している Task の入力バッファにこの Task から書き込みできる機能があると良い |
293 | 30 */ |
31 | |
109 | 32 void |
293 | 33 HTask::wait_for(HTaskPtr master) |
109 | 34 { |
35 mimpl->set_task_depend(master, this); | |
36 } | |
37 | |
547 | 38 void |
39 HTask::set_cpu(CPU_TYPE type) | |
40 { | |
109 | 41 mimpl->set_task_cpu(this, type); |
547 | 42 } |
43 | |
44 void | |
550 | 45 HTask::set_post(PostFunction func,void *arg1, void *arg2) |
547 | 46 { |
109 | 47 this->post_func = func; |
550 | 48 this->post_arg1 = arg1; |
49 this->post_arg2 = arg2; | |
547 | 50 } |
51 | |
687
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
52 #ifdef SIMPLE_TASK |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
53 |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
54 Task * |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
55 HTask::create_task(int task_id, int pos) |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
56 { |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
57 Task *task = (Task*)((memaddr)rbuf + pos); |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
58 task->set_task_id(task_id); |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
59 return task; |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
60 } |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
61 |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
62 #endif |
25afcd4ae380
test code for TaskArray
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
567
diff
changeset
|
63 |
547 | 64 /* end */ |