comparison example/renew_task/main.cc @ 487:df499063ccda

comment
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 06 Oct 2009 15:32:15 +0900
parents 00fe05184a02
children 1d4a8a86f26b
comparison
equal deleted inserted replaced
486:bfbad00ed9be 487:df499063ccda
6 6
7 extern void task_init(); 7 extern void task_init();
8 8
9 const char *usr_help_str = "Usage: ./renew_task"; 9 const char *usr_help_str = "Usage: ./renew_task";
10 10
11 SchedDefineTask(RenewRepeat);
12
13 static int count = 1;
14 static int task_count = 1;
15
16 static void
17 renewRepeat(void *arg)
18 {
19 TaskManager *manager = (TaskManager *)arg;
20
21 if (count-->0) {
22 HTask *repeat = manager->create_task(RENEW_REPEAT);
23 repeat->set_post(renewRepeat, (void*)manager);
24 repeat->spawn();
25
26 HTask *renew;
27
28 printf("[PPE] Create Task : RenewStart\n\n");
29
30 for(int i=0;i<task_count;i++) {
31 renew = manager->create_task(RENEW_START);
32 renew->set_cpu(SPE_ANY);
33 renew->add_param(i);
34
35 // add Active Queue
36 renew->spawn();
37 }
38 }
39 }
40
41 static int
42 run(SchedTask *s, void *rbuf, void *wbuf)
43 {
44 // RewnewRepeat Task
45 return 0;
46 }
47
11 static int 48 static int
12 init(int argc, char **argv) 49 init(int argc, char **argv)
13 { 50 {
51 for (int i = 1; argv[i]; ++i) {
52 if (strcmp(argv[i], "-count") == 0) {
53 count = atoi(argv[++i]);
54 } else if (strcmp(argv[i], "-task") == 0) {
55 task_count = atoi(argv[++i]);
56 }
57
58
59 }
14 return 0; 60 return 0;
15 } 61 }
16 62
17 static void 63 static void
18 renew_init(TaskManager *manager) 64 renew_init(TaskManager *manager)
19 { 65 {
20 HTask *renew; 66 HTask *repeat;
21 67
22 printf("[PPE] Create Task : RenewStart\n\n"); 68 printf("[PPE] Create Task : RenewRepeat\n\n");
23 69
24 renew = manager->create_task(RENEW_START); 70 repeat = manager->create_task(RENEW_REPEAT);
25 renew->set_cpu(SPE_ANY); 71 repeat->set_post(renewRepeat, (void*)manager);
26 72
27 // add Active Queue 73 // add Active Queue
28 renew->spawn(); 74 repeat->spawn();
29 } 75 }
30 76
31 int 77 int
32 TMmain(TaskManager *manager, int argc, char *argv[]) 78 TMmain(TaskManager *manager, int argc, char *argv[])
33 { 79 {