Mercurial > hg > Members > kono > Cerium
annotate example/renew_task/spe/RenewStart.cc @ 639:70c5c2d2eb24
fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Nov 2009 18:45:24 +0900 |
parents | ab866bc8a624 |
children |
rev | line source |
---|---|
192 | 1 #include <stdio.h> |
2 #include "RenewStart.h" | |
3 #include "SpeProfile.h" | |
4 #include "Func.h" | |
5 | |
298 | 6 /* これは必須 */ |
192 | 7 SchedDefineTask(RenewStart); |
8 | |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
9 static int |
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
10 run(SchedTask *s, void *rbuf, void *wbuf) |
192 | 11 { |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
12 s->printf("[SPE] ** running RenewStart\n"); |
192 | 13 |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
14 void *tmp = s->global_alloc(sizeof(SpeProfile), 0); |
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
15 // overlay で動くの? |
192 | 16 SpeProfile *profile = new (tmp) SpeProfile; |
17 | |
626
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
506
diff
changeset
|
18 int id = (long)s->get_param(0); |
506 | 19 s->printf("[SPE] Create Task : Renew1 %d\n", id); |
626
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
506
diff
changeset
|
20 HTaskPtr nextTask = s->create_task(RENEW1); |
488 | 21 |
626
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
506
diff
changeset
|
22 int *test_num = (int*)s->get_param(1); |
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
506
diff
changeset
|
23 int *local_num = (int*)s->allocate(sizeof(int)); |
506 | 24 *local_num = 555; |
488 | 25 |
506 | 26 // この add_inData は、メインメモリのアドレスになる。 |
488 | 27 nextTask->add_inData(test_num, sizeof(int)); |
506 | 28 // local なアドレスを渡したい時には、set_param を使う。 |
29 nextTask->add_param(local_num); | |
488 | 30 |
626
ab866bc8a624
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
506
diff
changeset
|
31 nextTask->spawn(); |
192 | 32 |
467
44c0bce54dcf
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
33 s->printf("[SPE] ** finish RenewStart\n\n"); |
192 | 34 |
35 profile->ProfStart(); | |
36 | |
37 return 0; | |
38 } |