Hi Daniel,

daniel sheltraw wrote:

> Hello RTAIers
>
> All the examples that I see of using RTAI in either one-shot or
> periodic mode make use of an infinite loop in the task function.
> My question is: Is there a problem (in one-shot mode) with replacing
> these loops with a terminating loop followed by an rt_task_suspend.
>
> Daniel

No problem. One-shot and periodic modes are different ways of
programming the timer. You can have a periodic task (with a call
to rt_task_make_periodic) timed with one-shot mode. So you can
suspend a periodic task after a finite number of cycles both in oneshot
and periodic mode in the same way.

For example:

void your_routine (int t)
{
    unsigned int counter = N_SAMPLES;
    while (counter--) {
        /* your stuff */
    }
    rt_task_suspend(rt_whoami());
}

Ciao, Lorenzo.

-- [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