Mercurial > hg > Members > kono > Cerium
view example/renew_task/spe/RenewStart.cc @ 506:1d4a8a86f26b
code_load in read()
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Oct 2009 02:50:01 +0900 |
parents | 63741e2dc6cb |
children | ab866bc8a624 |
line wrap: on
line source
#include <stdio.h> #include "RenewStart.h" #include "SpeProfile.h" #include "Func.h" /* これは必須 */ SchedDefineTask(RenewStart); static int run(SchedTask *s, void *rbuf, void *wbuf) { s->printf("[SPE] ** running RenewStart\n"); void *tmp = s->global_alloc(sizeof(SpeProfile), 0); // overlay で動くの? SpeProfile *profile = new (tmp) SpeProfile; int id = s->get_param(0); s->printf("[SPE] Create Task : Renew1 %d\n", id); TaskPtr nextTask = s->create_task(RENEW1); int *test_num = s->get_param(1); int *local_num = s->allocate(sizeof(int)); *local_num = 555; // この add_inData は、メインメモリのアドレスになる。 nextTask->add_inData(test_num, sizeof(int)); // local なアドレスを渡したい時には、set_param を使う。 nextTask->add_param(local_num); s->wait_task(nextTask); s->printf("[SPE] ** finish RenewStart\n\n"); profile->ProfStart(); return 0; }