6 #include <native/task.h>
7 #include <native/timer.h>
8 #include <native/sem.h>
19 void taskOne(void *arg
)
22 for (i
=0; i
< ITER
; i
++)
24 rt_printf("I am taskOne and global = %d................\n", ++global
);
28 void taskTwo(void *arg
)
31 for (i
=0; i
< ITER
; i
++)
33 rt_printf("I am taskTwo and global = %d----------------\n", --global
);
37 int main(int argc
, char* argv
[])
39 /* Perform auto-init of rt_print buffers if the task doesn't do so */
40 rt_print_auto_init(1);
42 /* Avoids memory swapping for this program */
43 mlockall(MCL_CURRENT
|MCL_FUTURE
);
45 /* create the two tasks */
46 rt_task_create(&t1
, "task1", 0, 1, 0);
47 rt_task_create(&t2
, "task2", 0, 1, 0);
49 /* start the two tasks */
50 rt_task_start(&t1
, &taskOne
, 0);
51 rt_task_start(&t2
, &taskTwo
, 0);