Mercurial > hg > Game > Cerium
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/renew_task/main.cc Tue Jan 13 10:41:05 2009 +0900 @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "TaskManager.h" +#include "Func.h" + +extern void task_init(void); + +const char *help_str = "Usage: ./renew_task"; + +static int +init(int argc, char **argv) +{ + for (int i = 1; argv[i]; ++i) { + if (strcmp(argv[i], "--help") == 0) { + printf("%s\n", help_str); + return -1; + } + } + + return 0; +} + +static void +renew_init(void) +{ + HTask *renew; + + printf("[PPE] Create Task : RenewStart\n\n"); + + renew = manager->create_task(RENEW_START); + renew->set_cpu(SPE_ANY); + + // add Active Queue + renew->spawn(); +} + +int +cerium_main(int argc, char *argv[]) +{ + if (init(argc, argv) < 0) { + return -1; + } + + // Task Register + // ppe/task_init.cc + task_init(); + + printf("[PPE] Program Start\n\n"); + + renew_init(); + + return 0; +}