6 #include <native/task.h>
7 #include <native/timer.h>
16 RT_TASK_INFO curtaskinfo
;
20 rt_printf("Hello World!\n");
22 // inquire current task
23 // below is commented and makes error
24 // curtask=rt_task_self();
25 retval
= rt_task_inquire(curtask
,&curtaskinfo
);
27 /* send error message */
30 rt_printf("Sending error %d : %s\n",-retval
,strerror(-retval
));
32 rt_printf("taskOne sent message to taskTwo\n");
36 rt_printf("Task name : %s \n", curtaskinfo
.name
);
40 int main(int argc
, char* argv
[])
44 // Perform auto-init of rt_print buffers if the task doesn't do so
45 rt_print_auto_init(1);
47 // Lock memory : avoid memory swapping for this program
48 mlockall(MCL_CURRENT
|MCL_FUTURE
);
50 rt_printf("start task\n");
55 * stack size (0=default),
57 * mode (FPU, start suspended, ...)
60 rt_task_create(&demo_task
, str
, 0, 50, 0);
67 rt_task_start(&demo_task
, &demo
, 0);