Mercurial > hg > Game > Cerium
comparison example/renew_task/main.cc @ 192:6694da357750 draft
add example/renew_task
author | gongo@localhost.localdomain |
---|---|
date | Tue, 13 Jan 2009 10:41:05 +0900 |
parents | |
children | c29b7163d6d9 |
comparison
equal
deleted
inserted
replaced
191:4f85911aa183 | 192:6694da357750 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 #include "TaskManager.h" | |
5 #include "Func.h" | |
6 | |
7 extern void task_init(void); | |
8 | |
9 const char *help_str = "Usage: ./renew_task"; | |
10 | |
11 static int | |
12 init(int argc, char **argv) | |
13 { | |
14 for (int i = 1; argv[i]; ++i) { | |
15 if (strcmp(argv[i], "--help") == 0) { | |
16 printf("%s\n", help_str); | |
17 return -1; | |
18 } | |
19 } | |
20 | |
21 return 0; | |
22 } | |
23 | |
24 static void | |
25 renew_init(void) | |
26 { | |
27 HTask *renew; | |
28 | |
29 printf("[PPE] Create Task : RenewStart\n\n"); | |
30 | |
31 renew = manager->create_task(RENEW_START); | |
32 renew->set_cpu(SPE_ANY); | |
33 | |
34 // add Active Queue | |
35 renew->spawn(); | |
36 } | |
37 | |
38 int | |
39 cerium_main(int argc, char *argv[]) | |
40 { | |
41 if (init(argc, argv) < 0) { | |
42 return -1; | |
43 } | |
44 | |
45 // Task Register | |
46 // ppe/task_init.cc | |
47 task_init(); | |
48 | |
49 printf("[PPE] Program Start\n\n"); | |
50 | |
51 renew_init(); | |
52 | |
53 return 0; | |
54 } |