Dear all:
I've been using RTLinux for a while and it's really cool. I just moved to
RTL2.0 and got some problems with it. Seems to me, the parameter "period"
in pthread_make_periodic_np() or rt_task_make_periodic() can be calculated
like this: 1193180/frequency. Say, if I want to run a task at 1KHz, I
should set "period" to 1193. This works fine in RTL1.x. I changed the
hello.c(See below) a little bit to have it run for 10 seconds. But it only
runs for about 8 seconds (from the time when I type "insmod hello.o" and
hit ENTER to the time I saw "stops!" in the console).

Any ideas?

Best Regards
Daniel

#include <rtl.h>
#include <time.h>
#include <pthread.h>

pthread_t thread;

void * start_routine(void *arg)
{
        struct sched_param p;
        int counter=10000;
        p . sched_priority = 1;
        pthread_setschedparam (pthread_self(), SCHED_FIFO, &p);

        pthread_make_periodic_np (pthread_self(), gethrtime(), 1193);

        while (counter) {
                counter--;
                pthread_wait_np ();
        }
        printk("stops!\n");
        return 0;
}

int init_module(void) {
        return pthread_create (&thread, NULL, start_routine, 0);
}

void cleanup_module(void) {
        pthread_delete_np (thread);
}

--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to