Kim Chuan Lim wrote:
> Hi Jan,
> 
> I try to run some old example from http://www.captain.at/xenomai.php
> I am getting feddup with some examples which keep on hanging my system.
> I thought maybe if i run the old examples with normal user mode, i
> will not crash the system.

Every program with RT power can hang your system: in an endless loop
with raise priority. That's why it's not that simple to allow non-root
RT access.

> 
> Between, the examples program in testsuits are too much complicated
> for beginner like me.
> Is there any up to date and easy understandable examples?

What about ksrc/skins/native/snippets/? They may not run but they can
give some ideas. Here is one of the simplest that does run (my classic
version):

#include <signal.h>
#include <sys/mman.h>
#include <native/task.h>

void demo(void *arg)
{
    rt_task_set_periodic(NULL, TM_NOW, 200000);
    while (1) {
        rt_task_wait_period(NULL);
        /* real-time jobs */
    }
}

void catch_signal(int sig) { }

int main(int argc, char* argv[])
{
    RT_TASK demo_task;

    signal(SIGINT, catch_signal);
    mlockall(MCL_CURRENT|MCL_FUTURE);
    rt_task_create(&demo_task, "mydemo", 0, 99, 0);
    rt_task_start(&demo_task, &demo, NULL);
    pause();
    rt_task_delete(&demo_task);
    return 0;
}

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to