6 #include <native/task.h>
7 #include <native/timer.h>
8 #include <native/intr.h>
17 void dummy_task_function(void *arg
)
21 rt_task_sleep(1e7
); //let linux system have time to kill the program
22 rt_printf("Dummy task spinning\n");
24 rt_printf("Dummy task stopped\n");
28 void keyboard_handler(void *arg
)
32 RT_TASK_INFO ctaskinfo
;
33 ctask
= rt_task_self();
34 rt_intr_create(&intr
, "keyboard handler", KBDIRQ
, I_PROPAGATE
);
37 rt_printf("Kbd interrupts: %d\n", kps
+= rt_intr_wait(&intr
, TM_INFINITE
));
38 rt_task_inquire(ctask
, &ctaskinfo
);
39 rt_printf("Prio: %d\n", ctaskinfo
.cprio
);
43 int main(int argc
, char* argv
[])
45 rt_print_auto_init(1);
47 mlockall(MCL_CURRENT
| MCL_FUTURE
);
49 rt_task_create(&task
, "task", 0, 50, 0);
50 rt_task_create(&dummy_task
, "dummy_task", 0, 51, 0);
52 rt_task_start(&task
, &keyboard_handler
, 0);
53 rt_task_start(&dummy_task
, &dummy_task_function
, 0);
55 rt_printf("CRTL+C to stop\n");